combine_logic: combine_logic: Combine multiple logical vectors with a...

View source: R/combine_logic.R

combine_logicR Documentation

combine_logic: Combine multiple logical vectors with a logical operator

Description

A utility function to combine two or more logical vectors using logical AND (&) or OR (|) operations. Supports NA handling and checks for consistent vector lengths.

Usage

combine_logic(..., op = "&", na.rm = FALSE)

Arguments

...

Logical vectors to combine.

op

Operator to apply: "&" (default) or "|".

na.rm

Logical. If TRUE, treats NA values as TRUE (default is FALSE).

Value

A single logical vector of the same length as inputs.

Examples

x <- 1:5
combine_logic(x > 2, x %% 2 == 1)            # AND by default
combine_logic(x > 2, x %% 2 == 1, op = "|")  # OR logic
combine_logic(c(TRUE, NA), c(TRUE, TRUE), na.rm = TRUE)

evanverse documentation built on March 10, 2026, 5:07 p.m.