[R] strange (to me) ncolumns default value in 'write'

Martin Maechler maechler at stat.math.ethz.ch
Mon Jun 5 11:42:19 CEST 2006


>>>>> "AntonioF" == Antonio, Fabio Di Narzo <antonio.fabio at gmail.com>
>>>>>     on Sun, 4 Jun 2006 18:42:35 +0200 writes:

    AntonioF> Hi all.
    AntonioF> In 'write' documentation, one can read:

    AntonioF> write(x, file = "data",
    AntonioF>       ncolumns = if(is.character(x)) 1 else 5,
    AntonioF>       append = FALSE, sep = " ")

    AntonioF> Now my question is: why the default value of 1column for character vectors
    AntonioF> and the special value '5' for non character vectors?

well, most of us have five fingers per hand, so many consider
'5' to be a 'nice' number :-)
For R, the main reason of using this default, was that S already
had it.  And S has had it not only for the above reason, but I
guess also because nicely, 5 * 16 = 80, and 80 used to be the
customary terminal width in the 70s and 80s, i.e., the good old
times S was created.

    AntonioF> Nice sunday to all,

and Pentecoste Monday, for those with an extra free day 
like me.

Martin Maechler, ETH Zurich

    AntonioF> Antonio, Fabio Di Narzo.

    AntonioF> Note: this is just curiosity. Don't read as: "WHY? WHY!?!?", but just as
    AntonioF> "why?"



More information about the R-help mailing list