assign_SEQ {sdtmval}R Documentation

Assign SEQ numbers for a SDTM data set

Description

Assigns the "[DOMAIN]SEQ" number by sorting the data set by the specified variables and then grouping by "USUBJID".

Usage

assign_SEQ(tbl, key_vars, seq_prefix, USUBJID = "USUBJID")

Arguments

tbl

a data frame, the SDTM table

key_vars

a character vector of the key variables to sort by

seq_prefix

a string, the prefix for SEQ as per the spec (usually the two letter domain abbreviation)

USUBJID

a string, the column for the subject ID, USUBJID, default is "USUBJID"

Value

a sorted copy of the tbl data frame with the new SEQ column

Examples

df <- data.frame(
  USUBJID = paste("Subject", c(rep(1, 3), rep(2, 3))),
  XXTESTCD = paste("T", rep(c(2, 3, 1), 2))
)
assign_SEQ(df, key_vars = c("USUBJID", "XXTESTCD"), seq_prefix = "XX")


[Package sdtmval version 0.4.1 Index]