Displaying 1 result from an estimated 1 matches for "byselectrows".
2012 Mar 26
1
assigning vector or matrix sparsely (for use with mclapply)
...ting this may make life easier for other
googlers.) I pass a data frame, a vector that tells me what rows
should be recomputed, and the function; and I get 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
recomp...