bsv: Construct Between Subset Variable (BSV)

Description Usage Arguments Details Author(s) See Also Examples

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


Search within the datadr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.