is_applicable_to_covset: Check equation for covariates

Description Usage Arguments Value Methods (by class) Examples

View source: R/is_applicable_to_covset.R

Description

Check if any of the given equation(s) can be applied to the supplied set of covariates

Usage

1
2
3
4
5
6
7
is_applicable_to_covset(x, cov)

## S3 method for class 'eq'
is_applicable_to_covset(x, cov)

## S3 method for class 'eqs'
is_applicable_to_covset(x, cov)

Arguments

x

equation(s set/bag) object

cov

(chr) vector of covariates

Value

(lgl) TRUE if the covariates supplied are a subset of the covariates needed to solve at least one of the equations in x.

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(equationer)
eq_test <- eq(age = 0.1, bmi = -0.3,
    name    = "first eq_test",
    outcome = "kcal/day"
)
is_applicable_to_covset(eq_test, c("age", "bmi")) # TRUE
is_applicable_to_covset(eq_test, c("age", "bmi", "sex")) # TRUE
is_applicable_to_covset(eq_test, c("age")) # FALSE
is_applicable_to_covset(eq_test, c("age", "sex")) # FALSE
library(equationer)
eq_test <- eq(age = 0.1, bmi = -0.3,
    name    = "eq_test",
    outcome = "kcal/day",
    strata = list(sex = "female")
)
eq2_test <- eq(age = 0.1, bmi = -0.3,
    name    = "eq2_test",
    outcome = "kcal/day",
    strata = list(sex = "male")
)

eqs_test <- eqs(eq_test, eq2_test, name = "eqs-test")

is_applicable_to_covset(eqs_test, c("age", "bmi")) # TRUE
is_applicable_to_covset(eqs_test, c("age", "bmi", "sex")) # TRUE
is_applicable_to_covset(eqs_test, c("age")) # FALSE
is_applicable_to_covset(eqs_test, c("age", "sex")) # FALSE

UBESP-DCTV/equationer documentation built on Jan. 17, 2021, 6:30 p.m.