search for: newlapply

Displaying 2 results from an estimated 2 matches for "newlapply".

2015 Feb 26
3
iterated lapply
...assign("x", rep.int(x, v), envir = parent.frame(2))) m[, i] <- x (I think the parent.frame(2) might have to be changed to parent.frame(8) for that to work. Such code looks pretty ugly to me but seems to be rare.) It also seems to cause problems with some built-in functions: newlapply <- function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.list(X)) X <- as.list(X) rval <- vector("list", length(X)) for (i in seq(along = X)) { rval[i] <- list(local({ i <- i FUN(X[[i]], ...) })) }...
2015 Feb 24
3
iterated lapply
From: Daniel Kaschek <daniel.kaschek at physik.uni-freiburg.de> > ... When I evaluate this list of functions by > another lapply/sapply, I get an unexpected result: all values coincide. > However, when I uncomment the print(), it works as expected. Is this a > bug or a feature? > > conditions <- 1:4 > test <- lapply(conditions, function(mycondition){ >