Learn R Programming

simstudy (version 0.1.1)

addPeriods: Create longitudinal/panel data

Description

Create longitudinal/panel data

Usage

addPeriods(dtName, nPeriods = NULL, idvars = "id", timevars = NULL, timevarName = "timevar")

Arguments

dtName
Name of existing data table
nPeriods
Number of time periods for each record
idvars
Names of index variables (in a string vector) that will be repeated during each time period
timevars
Names of time dependent variables. Defaults to NULL.
timevarName
Name of new time dependent variable

Value

An updated data.table that that has multiple rows per observation in dtName