listIf: listIf

View source: R/dataCheck.R

listIfR Documentation

listIf

Description

Simple list all of specified variable for which row data meets specific conditions. Option for removing NAs. Option to have output as list or collapsed string. First column use as default if no variable specified or variable specified is not within the datset.

Usage

listIf(data, varname = NULL, cond = NULL, collapse = FALSE, na.rm = FALSE)

Arguments

data

The dataset to process

varname

The ID varname which will be printed for each row where condition is not true

cond

The condition to verify

collapse

If true then ...

na.rm

Should missing be included

Value

A list of records

Examples


df1 <- data.frame(Id = c(1,2,3,4,5,6,7,8,9,10, NA_real_)
, A = c("a", "b", "c", "d", "e","a", "b", "c", "d", "e", "b")
, B = c("", "dog", "cat", "rabbit", "mole", "dog", "horse", "cat", "", NA_character_, "mouse")
)

listIf(data=df1, varname="Id", cond = A=="b", na.rm=TRUE)


Epiconcept-Paris/STRAP-epiuf documentation built on Aug. 5, 2024, 3:41 a.m.