eapply(env, FUN, ..., all.names = FALSE, USE.NAMES = TRUE)
env | the environment to which FUN is applied. |
FUN | the function to apply to the objects in env. Alternatively, it can be a character string giving the name of the function. |
... | other arguments to FUN, if any. They can be given with names. |
all.names | a logical flag. If TRUE, all names in the variable in env are applied with FUN. If FALSE (the default), all names variables except the hidden variable(that is, names that begin with dot) are applied. |
USE.NAMES | a logical flag. If TRUE (the default), names are included in the returned list. |
newEnv <- new.env() assign("x", c(1:10), envir = newEnv) # same as: newEnv$x <- c(1:10) assign("y", c(4, 5), envir = newEnv) # same as: newEnv$y <- c(4, 5) eapply(newEnv, sin) eapply(newEnv, sum) eapply(newEnv, f<-function(x,y) x+y, y = 2)newEnv$.Matrix <- matrix(1:12, nrow = 3) # create a hidden variable.
# By default, the hidden variables are not applied with sum. eapply(newEnv, sum)
# .Matrix is also applied with sum. eapply(newEnv, sum, all.names = TRUE)
# No names in returned list eapply(newEnv, sum, all.names = TRUE, USE.NAMES = FALSE)