
Construct between subset variable (BSV)
For a given key-value pair, get a BSV variable value by name (if present)
bsv(val = NULL, desc = "")getBsv(x, name)
getBsvs(x)
a scalar character, numeric, or date
a character string describing the BSV
a key-value pair or a value
the name of the BSV to get d <- divide(iris, by = "Species", bsvFn = function(x) list(msl = bsv(mean(x$Sepal.Length)))) getBsvs(d[[1]]$value) getBsv(d[[1]]$value, "msl")
Should be called inside the bsvFn
argument to divide
used for constructing a BSV list for each subset of a division.
# NOT RUN {
irisDdf <- ddf(iris)
bsvFn <- function(dat) {
list(
meanSL = bsv(mean(dat$Sepal.Length), desc = "mean sepal length"),
meanPL = bsv(mean(dat$Petal.Length), desc = "mean petal length")
)
}
# divide the data by species
bySpecies <- divide(irisDdf, by = "Species", bsvFn = bsvFn)
# see BSV info attached to the result
bsvInfo(bySpecies)
# get BSVs for a specified subset of the division
getBsvs(bySpecies[[1]])
# }
Run the code above in your browser using DataLab