Learn R Programming

teal.slice (version 0.5.1)

calls_combine_by: Compose predicates

Description

Combines calls with a logical operator.

Usage

calls_combine_by(calls, operator)

Value

A call where elements of calls are composed with operator or NULL if calls is an empty list.

Arguments

calls

(list) containing calls (or symbols) to be combined by operator

operator

(character(1)) infix operator to use in predicate composition, e.g. "&"

Details

This function is used to combine logical predicates produced by FilterState objects to build a complete subset expression.

Examples

Run this code
# use non-exported function from teal.slice
calls_combine_by <- getFromNamespace("calls_combine_by", "teal.slice")

calls <- list(
  quote(SEX == "F"), # subsetting on factor
  quote(AGE >= 20 & AGE <= 50), # subsetting on range
  quote(!SURV) # subsetting on logical
)
calls_combine_by(calls, "&")

Run the code above in your browser using DataLab