LongToWide | R Documentation |
Transposing a dataset with repeated measurements/responses for each subject from longitudinal to wide format.
LongToWide(subject.id, time.sequence, outcome, verbose = FALSE)
subject.id |
a column of subject identifiers |
time.sequence |
a column of time points |
outcome |
a column to be transposed |
verbose |
TRUE or FALSE (default = FALSE) prints output to screen (OPTIONAL INPUT) |
If data is not sorted by subject.id, a warning message will appear. The function will then sort the data by subject.id. It is recommended that the user sorts the data prior to using this function.
|
a matrix in wide format, in which each column is the outcome for each subject and each row is the time sequence |
# CREATING A TRANSPOSED MATRIX FOR MEDIATOR `WantToSmokeLst15min` data(smoker) mat.wide <- LongToWide(smoker$SubjectID, smoker$timeseq, smoker$WantToSmokeLst15min)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.