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 class 'list'
blapply(x, f, mc = TRUE, progress = TRUE, verbose = FALSE, ...)

# S4 method for class 'vector'
blapply(x, f, mc = FALSE, progress = TRUE, verbose = FALSE, ...)

# S4 method for class 'bundle'
blapply(x, f, mc = FALSE, progress = TRUE, verbose = FALSE, ...)

Arguments

x

a list or a bundle object

...

further parameters

f

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 )

mc

logical, whether to use multicore - if TRUE, the number of cores will be taken from the polmineR-options

progress

logical, whether to display progress bar

verbose

logical, whether to print intermediate messages

Examples

use("polmineR")
#> ✔ corpus loaded: GERMAPARLMINI (version: 0.1.0 | build date: 2023-04-16)
bt <- partition("GERMAPARLMINI", date = ".*", regex=TRUE)
#> ... get cpos and strucs
speeches <- as.speeches(bt, s_attribute_date = "date", s_attribute_name = "speaker")
#> ℹ distinct dates detected: 5
#> ℹ subsetting by date
#> ℹ bundle class: partition_bundle
#> ℹ subsetting by date

#> ℹ objects in bundle: plpr_partition
#> ℹ subsetting by date

#> ℹ s-attribute for splitting ("date") is sibling of s-attribute "date"
#> ℹ subsetting by date

#> ℹ s-attribute "date" has values: yes
#> ℹ subsetting by date

#> ℹ get list of regions
#> ✔ get list of regions [8ms]
#> 
#> ℹ subsetting by date

#> ℹ instantiate 5 plpr_partition objects 
#> ✔ instantiate 5 plpr_partition objects  [19ms]
#> 
#> ℹ subsetting by date

#> ✔ subsetting by date [86ms]
#> 
#> ℹ generating speeches
#> ✔ generating speeches [483ms]
#> 
#> ℹ generating names
#> ✔ generating names [49ms]
#> 
#> ℹ reordering partitions
#> ✔ reordering partitions [15ms]
#> 
#> ℹ coercing partitions to plpr_partitions
#> ✔ coercing partitions to plpr_partitions [17ms]
#> 
foo <- blapply(speeches, function(x, ...) slot(x, "cpos"))