is_valid_formula: Is valid formula

View source: R/1_assertions.R

is_valid_formulaR Documentation

Is valid formula

Description

Is valid formula

Usage

is_valid_formula(
  x,
  y,
  .xname = get_name_in_parent(x),
  .yname = get_name_in_parent(y)
)

assert_valid_formula(
  x,
  y,
  .xname = get_name_in_parent(x),
  .yname = get_name_in_parent(y)
)

Arguments

x

formula

y

SummarizedExperiment

.xname

string

.yname

string

Value

TRUE or false

Examples

object <- matrix(1:9, nrow = 3)
rownames(object) <- sprintf('f%d', 1:3)
colnames(object) <- sprintf('s%d', 1:3)
object <- list(exprs = object)
object %<>% SummarizedExperiment::SummarizedExperiment()
object$group    <- 'group0'
object$subgroup <- c('A', 'B', 'C')
svars(object)
    is_valid_formula( 'condition',   object)   # not formula
    is_valid_formula( ~condition,    object)   # not svar
    is_valid_formula( ~group,        object)   # not multilevel
    is_valid_formula( ~subgroup,     object)   # TRUE
    is_valid_formula( ~0+subgroup,   object)   # TRUE
    is_valid_formula( ~1,            object)   # TRUE
assert_valid_formula( ~subgroup,     object)

bhagwataditya/importomics documentation built on Nov. 28, 2024, 8:28 a.m.