Hi!

29.01.2010 12:49, soeren.vo...@eawag.ch wrote:
> Hello,
> 
> I read the help as well as the examples, but I can not figure out why
> the following code does not produce the *given* row names, "x" and "y":
> 
> x <- 1:20
> y <- 21:40
> rbind(
>   x=cbind(N=length(x), M=mean(x), SD=sd(x)),
>   y=cbind(N=length(y), M=mean(y), SD=sd(y))
> )
> 

Maybe because the cbinds in your code produce matrices:

is.matrix(cbind("N"=length(x), "M"=mean(x), "SD"=sd(x)))
[1] TRUE

Quote ?rbind:
"For cbind (rbind) the column (row) names are taken from the colnames
(rownames) of the arguments if these are matrix-like."

HTH,
Kimmo

______________________________________________
R-help@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.

Reply via email to