[R] Printing data frame with million rows

David Winsemius dwinsemius at comcast.net
Mon Aug 8 02:25:08 CEST 2011


On Aug 7, 2011, at 5:51 PM, peter dalgaard wrote:

>
> On Aug 7, 2011, at 21:31 , David Winsemius wrote:
>
>>
>> On Aug 7, 2011, at 2:37 PM, peter dalgaard wrote:
>>
>>>
>>> On Aug 7, 2011, at 20:27 , David Winsemius wrote:
>>>
>>>>
>>>> On Aug 7, 2011, at 2:08 PM, Bansal, Vikas wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> I was working on number of files and at the end I got a data  
>>>>> frame with approx. million rows.To prin this data frame in  
>>>>> output, I used
>>>>>
>>>>> capture.output(print.data.frame(end,row.names=F), file =  
>>>>> "summary", append = FALSE)
>>>>>
>>>>> where end is the name of my data frame and summary is the name  
>>>>> of my output file.
>>>>>
>>>>> but when I checked the output there were only 10000 rows and at  
>>>>> the last it was written-
>>>>>
>>>>> [ reached getOption("max.print") -- omitted 923750 rows ]]
>>>>>
>>>>> Can you please tell me what is wrong with my output code?
>>>>
>>>> Nothing.
>>>>
>>>>> I want to print all million rows in my output.
>>>>
>>>> I'm trying to figure out why, after that warning message, you did  
>>>> not immediately pull up the help page for getOption?
>>>
>>> Perhaps he was looking for a way to override the option rather  
>>> than change it?
>>>
>>> print(...., max=2e6)
>>>
>>> should do the trick. (Documented on help(print.default), which  
>>> perhaps _is_ a little hard to find your way to.)
>>
>> You mean that options(max.print=2e6) wouldn't have done the same  
>> thing? That was what I thought would work when I looked at  
>> help(getOption). Seemed to work just fine when I just tested it.
>>
>
> It does, but next time he does something to the million-row data  
> frame, and forgets to assign the result, he'll see a million lines  
> whizzing by in his console. Unless he remembers to do
>
> old <- options(max.print=2e6)
> print(....)
> options(old)

I thought the implications of the option change were obvious, as well  
as the way to set it back to a smaller number. In addition that change  
would only have lasted during the current session and would revert to  
the default with the next session. It's not like I told him to change  
it in his .Rprofile after all.


>
>> -- 
>> David Winsemius, MD
>> West Hartford, CT
>>
>
> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> "Døden skal tape!" --- Nordahl Grieg
>
>
>
>
>
>
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list