Very similar to lapply, but applicable to bundle-objects, in particular. The purpose of the method is to supply a uniform und convenient parallel backend for the polmineR package. In particular, progress bars are supported (the naming of the method is derived from bla bla).
blapply(x, ...)# S4 method for list
blapply(x, f, mc = TRUE, progress = TRUE,
verbose = FALSE, ...)
# S4 method for vector
blapply(x, f, mc = FALSE, progress = TRUE,
verbose = FALSE, ...)
# S4 method for bundle
blapply(x, f, mc = FALSE, progress = TRUE,
verbose = FALSE, ...)
a list or a bundle object
further parameters
a function that can be applied to each object contained in the bundle, note that it should swallow the parameters mc, verbose and progress (use ... to catch these params )
logical, whether to use multicore - if TRUE, the number of cores will be taken from the polmineR-options
logical, whether to display progress bar
logical, whether to print intermediate messages
Parallel backend supported so far are the parallel package (mclapply), and doMC, doParallel and doSNOW in combination with foreach. The parallel backend to be used is taken from the option 'polmineR.backend' (getOption("polmineR.backend")), the number of cores from the option 'polmineR.cores' (getOption("polmineR.cores")).
# NOT RUN {
use("polmineR.sampleCorpus")
bt <- partition("PLPRBTTXT", list(text_id=".*"), regex=TRUE)
speeches <- as.speeches(bt, sAttributeDates="text_date", sAttributeNames="text_name")
foo <- blapply(speeches, function(x, ...) slot(x, "cpos"))
# }
Run the code above in your browser using DataLab