Description Usage Arguments Details Author(s) See Also Examples
Construct between subset variable (BSV)
For a given key-value pair, get a BSV variable value by name (if present)
1 2 3 4 5 |
val |
a scalar character, numeric, or date |
desc |
a character string describing the BSV |
x |
a key-value pair or a value |
name |
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.
Ryan Hafen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.