Hi everyone,
This
x <- list(12, 13)
names(y <- x) <- c("a", "b")
gives the error:
Error in names(y <- x) <- c("a", "b") : object 'y' not found
Can anyone explain why?
According to R's rules of evaluation y <- x
should be evaluated inside the parent frame of names<-. So y should be created in global environment.
Thanks.
[update] If object y
is already present in the global environment, then the error is:
Error in names(y <- x) <- c("a", "b") : could not find function "<-<-"
[update2] Here it is, another construct, which I encountered today.
(X <- matrix(0, nrow = 10, ncol = 10))[1:3] <- 3:5
Error during wrapup: object 'X' not found