Learn R Programming

yamlet (version 1.2.1)

singularity: 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, ...)

Value

integer, possibly NA

Arguments

x

list of expressions

data

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

...

ignored

See Also

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

Examples

Run this code
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'"
  )
)

Run the code above in your browser using DataLab