Hi there,

I cannot find a detailed explanation to the following error message:

> colnames(matrix(1:10, ncol = 2)) <- c("X", "Y")
Error in colnames(matrix(1:10, ncol = 2)) <- c("X", "Y") :
  target of assignment expands to non-language object

However, when I do the following things, the error message disappear:

> z <- matrix(1:10, ncol = 2)
> colnames(z) <- c("X","y")

What's the difference between the two methods?

Any comments or suggestions? Thank you very much in advance!

Regards,
Jinsong

______________________________________________
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