create_STAT {sdtmval}R Documentation

Assign STAT 'NOT DONE' status

Description

Creates a –STAT variable and, if all measurements for a visit were not done, also changes all –TESTCD values as "–ALL"

Usage

create_STAT(
  df,
  domain,
  nd_ind,
  nd_ind_cd = "Yes",
  USUBJID = "USUBJID",
  VISIT = "VISIT"
)

Arguments

df

a data frame to modify

domain

a string, the domain abbreviation in all caps

nd_ind

a string, the variable name in df that indicates if a test was not performed, usually a "Yes"/"No" or "Y"/"N" column

nd_ind_cd

a string, the code from the nd_ind column that signifies a test was not done, default is "Yes"

USUBJID

a string, the variable name in df that contains the subject identifier, default is "USUBJID"

VISIT

a string, the variable name in df that indicates a VISIT field, default is "VISIT"

Value

a modified copy of df

Examples

df <- dplyr::tibble(
  USUBJID = paste("Subject", c(rep("A", 2), rep("B", 4), rep("C", 2))),
  VISIT = paste("Visit", c(1  , 2  , 1  , 1  , 2  , 2  , 2  , 2)),
  XXTESTCD = paste("Test", c(1  , 2  , 1  , 2  , 1  , 2  , 1  , 2)),
  ND = c("N", "N", "Y", "Y", "N", "N", "Y", "Y")
)
create_STAT(df = df, domain = "XX", nd_ind = "ND", nd_ind_cd = "Y")


[Package sdtmval version 0.4.1 Index]