Displaying 1 result from an estimated 1 matches for "recalclist".
2012 Mar 26
1
assigning vector or matrix sparsely (for use with mclapply)
...back a vector or
matrix of answers.
d <- data.frame( id=1:6, val=11:16 )
loc <- c(TRUE,TRUE,FALSE,TRUE,FALSE,TRUE)
v1 <- mc.byselectrows( d, loc, function(x) x[,2]^2 )
v2 <- mc.byselectrows(d, loc, function(x) cbind(x[,2]^2,x[,2]^3))
mc.byselectrows <- function(data.in, recalclist, FUN, ...) {
? data.notdone <- data.in[recalclist,]
? cat.stderr("[mc.byselectrows: ", nrow(data.notdone), "rows to be
recomputed out of", nrow(data.in), "]\n")
? FUN.ON.ROWS <- function(.index, ...)
as.matrix(FUN(data.notdone[.index,], ...))
? soln <- mclap...