it
x <- list(12, 13)
names(y <- x) <- c("a", "b")
gives an error:
Error in names(y <- x) <- c("a", "b") : object 'y' not found
Can someone explain why?
According to R, scoring rules y <- xmust be scored within the parent <-. Therefore, y must be created in a global environment.
Thank.
[update] If the object is yalready present in the global environment, then the error:
Error in names(y <- x) <- c("a", "b") : could not find function "<-<-"
[update2] Here is another design I came across today.
(X <- matrix(0, nrow = 10, ncol = 10))[1:3] <- 3:5
Error during wrapup: object 'X' not found
source
share