Construct Between Subset Variable (BSV)

Share:

Description

Construct between subset variable (BSV)

For a given key-value pair, get a BSV variable value by name (if present)

Usage

1
2
3
4
5
bsv(val = NULL, desc = "")

getBsv(x, name)

getBsvs(x)

Arguments

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")

Details

Should be called inside the bsvFn argument to divide used for constructing a BSV list for each subset of a division.

Author(s)

Ryan Hafen

See Also

divide, getBsvs, bsvInfo

Examples

 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]])

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.