[R] Data.frame columns in R console

Martin Maechler maechler at stat.math.ethz.ch
Fri Feb 9 14:49:16 CET 2007

>>>>> "Lauri" == Lauri Nikkinen <lauri.nikkinen at iki.fi>
>>>>>     on Fri, 9 Feb 2007 14:21:26 +0200 writes:

    Lauri> This still does not solve the issue that when I print in R console I get
    Lauri> columns that don't fit in the window underneath each other. Thanks anyway!

But Brian did give you all you needed (even more I'd say) to
solve that !?!?
Please apologize if I use a bit frank language, but using R, you
*really* are expected to read the documentation which is written
pretty carefully {probably that's what some people don't like
about it and call "confusing" ??}.

Specifically, Brian said

 BDR> 200 columns will take far more than 250 characters.  The help says

and then pointed you to the docu for options(width = .).
I think you need to reread that paragraph, particularly the word
'character' and then you will understand that your original
approach of using options(width = 250) can *not* be what you
want if your dataframe has 200 columns.


    Lauri> 2007/2/9, Martin Maechler <maechler at stat.math.ethz.ch>:
    >> >>>>> "Petr" == Petr Pikal <petr.pikal at precheza.cz>
    >> >>>>>     on Fri, 09 Feb 2007 09:42:13 +0100 writes:
    Petr> Hi
    Petr> On 9 Feb 2007 at 10:17, Lauri Nikkinen wrote:
    >> >> Thank you for your answer. When I set options(width=250) I still get
    >> >> the same result when I print the data.frame on my Rgui console (R
    >> >> 2.4.1, Windows XP). Colums become underneath each other. I also get
    >> an
    >> >> error (?) message
    >> >> [ reached getOption("max.print") -- omitted 3462 rows ]].
    >> As Petr explains below (and Brian Ripley), you
    >> *really* should use different means here ---
    >> but I think this is the first time that  the relatively new
    >> option 'max.print' has "hit R-help", hence one other hint, maybe
    >> useful to the public:
    >> Note that the 'max.print' option was introduced exactly for the
    >> purpose of **protecting** the inadvertent user from a flood of output
    >> spilling into his console/gui/..
    >> (and apparently locking up R completely, we have even seen
    >> crashes when people wanted to print dataframes/matrices/arrays
    >> with millions of entries).
    >> So, given the above message (yes, not an error),
    >> why did you not try to read
    >> help(getOption)
    >> and look for the word 'max.print' there ?
    --> if you really really don't want to follow the advice of
    >> Brian and Petr, then say something like
    >> options(max.print = 1e6)
    >> Martin Maechler, ETH Zurich
    >> >> For example if I have a data.frame with 4000 rows and 200
    >> >> columns I would like to be able to use scroll bars in
    >> >> Rconsole to investigate the whole data.frame.
    Petr> I am not sure if it is the best idea. You shall probably use
    >> other
    Petr> means for checking your data frame.
    Petr> Try ?summary, ?str or if you really want to check all values in
    >> data
    Petr> frame you can use
    Petr> invisible(edit(test))
    Petr> to open a spreadsheet like editor.
    Petr> HTH
    Petr> Petr

    Lauri> [[alternative HTML version deleted]]

    Lauri> ______________________________________________
    Lauri> R-help at stat.math.ethz.ch mailing list
    Lauri> https://stat.ethz.ch/mailman/listinfo/r-help
    Lauri> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
    Lauri> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list