View source: R/UniqueVariables.R
UniqueVariables | R Documentation |
This function extracts a set of unique variables within a patient, returning a data frame with columns, patient identification and variables selected. Each row corresponds to the data for each individual.
UniqueVariables(data, var.col, id.col = "ID")
data |
data frame, or matrix, with at least a column of patient identification and a covariate column. |
var.col |
vector of column names or column numbers, of the variables (non-time dependent). Cannot have mix of numbers and column names. |
id.col |
column name or column number of the patient identification. |
This function can be used, when longitudinal data is in the unbalanced format, and it is necessary, for example, to extract the set of unique baseline covariates, or any non-time dependent variables, that in the unbalanced format, are repeated for each observation row. Also, if the original data frame has survival data, this can also be used to extract the survival information from the original data set.
A data frame with patient identification and covariates selected. Each row corresponds to the data for each individual. Note that, this can be only used for non-time dependent covariates. If extracting unique time dependent covariates, the function gives an error, because it can't select what is the unique covariate.
Ines Sousa
data(heart.valve) heart.cov <- UniqueVariables(heart.valve, c(2, 3, 5, 6, 12:25), id.col = "num")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.