[R] Printing data frame with million rows
peter dalgaard
pdalgd at gmail.com
Sun Aug 7 23:51:50 CEST 2011
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)
> --
> 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
More information about the R-help
mailing list