dh.defineCases: Indicates whether each subject has any or all of the...

View source: R/define-cases.R

dh.defineCasesR Documentation

Indicates whether each subject has any or all of the variables contained within a set

Description

In an analysis you may want to subset your dataset to contain only subjects meeting a specific criteria, e.g. data on at least one outcome or data on all exposures. This function automates this operation by describing whether a subject has non-missing values for any or all of a set of given variables.

Usage

dh.defineCases(
  df = NULL,
  vars = NULL,
  type = NULL,
  new_obj = NULL,
  conns = NULL,
  checks = FALSE,
  newobj = NULL
)

Arguments

df

Character specifying a server-side data frame.

vars

Character vector of columns within 'df' to form definition set.

type

Character specifying how to define cases. Use "any" to describe subjects with data on any of 'vars', and "all" to describe subjects with data on all of 'vars.

new_obj

Character specifying name for created serverside object.

conns

DataSHIELD connections object.

checks

Logical; if TRUE checks are performed prior to running the function. Default is TRUE.

newobj

Retired argument name. Please use ‘new_obj’ instead.

Details

This function replaces the deprecated dh.subjHasData.

Value

Server-side vector defining whether subject meets criteria defined by 'vars' and 'type'. 1 indicates that criteria were met, 0 indicates that criteria weren't met.

See Also

Other descriptive functions: dh.anyData(), dh.classDiscrepancy(), dh.createTableOne(), dh.getStats(), dh.lmTab(), dh.meanByGroup()


lifecycle-project/ds-helper documentation built on Oct. 27, 2023, 2:08 p.m.