singularity: Choose Singular Expression

View source: R/singularity.R

singularityR Documentation

Choose Singular Expression

Description

For a list of expressions evaluated within data, this returns the index of the one expression that evaluates to an all-true vector (after coercing NA to FALSE). Returns 0 if no expressions succeed, and NA_integer_ if more than one succeed. Returns -1 if any expression does not evaluate to logical or if list is empty.

Usage

singularity(x, data, ...)

Arguments

x

list of expressions

data

something coercible to a data environment (typically data.frame)

...

ignored

Value

integer, possibly NA

See Also

Other promote: [.decorated(), filter.decorated(), promote.data.frame(), promote.list(), promote()

Examples

meta <- system.file(package = 'yamlet', 'extdata','phenobarb.csv')
x <- read.csv(meta)
singularity(
  data = x,
  list(
    "event == 'conc'",
    "event == 'dose'",
    "event == 'metabolite'"
  )
)
singularity(
  data = x[x$event == 'dose',],
  list(
    "event == 'conc'",
    "event == 'dose'",
    "event == 'metabolite'"
  )
)
singularity(
  data = x[x$event == 'dose',],
  list(
    "time >= 0",
    "event == 'dose'"
  )
)

yamlet documentation built on Oct. 6, 2023, 9:07 a.m.