[R] colnames documentation
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Feb 11 20:08:14 CET 2012
On 10.02.2012 04:53, R. Michael Weylandt wrote:
> Consider the following in R 2.14.1 (seems to still be the case in Rdevel):
>
> x<- matrix(1:9, 3)
> colnames(x) # NULL as expected
> colnames(x, do.NULL = TRUE) # NULL -- since we didn't change the default
> colnames(x, do.NULL = FALSE) # "col1" "col2" "col3"
>
> This doesn't really seem to square with the documentation which reads:
>
> do.NULL: logical. Should this create names if they are ‘NULL’?
>
> The details section expounds and says:
>
> If ‘do.NULL’ is ‘FALSE’, a character vector (of length ‘NROW(x)’
> or ‘NCOL(x)’) is returned in any case, prepending ‘prefix’ to
> simple numbers, if there are no dimnames or the corresponding
> component of the dimnames is ‘NULL’.
>
> But I have to admit that I don't really get it. (The interpretation of
> the docs; I understand the functionality) Could someone enlighten me?
> Given what the details section says (and the behavior of the function
> is), I'd expect something more like:
>
> do.NULL: logical. Is NULL an acceptable return value? If FALSE,
> column names derived from prefix are returned.
Changed to
\item{do.NULL}{logical. If \code{FALSE} and names are \code{NULL}, names
are created.}
> Michael
>
> PS -- In my searching, I think the link to the svn on the developer
> page (http://developer.r-project.org/) is wrong: clicking it takes one
> to what appears to be the same page: am I incorrect in assuming it
> should link to http://svn.r-project.org/R for the current svn?
I think you followed the link to the svn sources of that developer page
(rather than the software R).
Uwe
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list