Hi there,

In function, it's usually using ``='' to assign default value for function argument. For newbie, it's possible to using ``<- '' to assign value for function argument. Although it's not a correct way, R don't give any warning message.

> matrix(1:20, ncol <- 4)
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    5    9   13   17
[2,]    2    6   10   14   18
[3,]    3    7   11   15   19
[4,]    4    8   12   16   20

It seems that R ignore the ``ncol <-'' and assign the value 4 to ``nrow''.

Would anyone here give a more detailed explanation about this? Thanks in advance!

Best 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