Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

to.unbalanced

Transform data to the longitudinal unbalanced format


Description

Transforms a longitudinal data set in the balanced format to the unbalanced format.

Usage

to.unbalanced(data, id.col, times, Y.col, other.col = NA)

Arguments

data

a data frame with longitudinal data in the balanced format. That is, in the format of 'one row per subject'. data, where the patient identifications is.

id.col

a column number, or column name, in the data frame data, where the patient identifier is located.

times

a vector with the unique time points where the patients are observed. This is the study design time points in a balanced data set.

Y.col

a vector of column numbers, or column names, of longitudinal variables, and/or time dependent covariates in the data frame data.

other.col

a vector of column numbers, or column names, of baseline covariates, and/or other subject level data, as for example, survival data. Default does not include other.col.

Value

A data frame with longitudinal data in the unbalanced format. The unbalanced format is considered in this context as the format where each row has data on each subject observation.

Author(s)

Ines Sousa (isousa@uminho.pt)

See Also

Examples

simul <- data.frame(num = 1:10,
                    Y1.1 = rnorm(10), Y1.2 = rnorm(10),
                    Y2.1 = rnorm(10), Y2.2 = rnorm(10), 
                    age = rnorm(10))
to.unbalanced(simul, id.col = 1, times = c(1, 2), Y.col = 2:5,
              other.col = 6)

joineR

Joint Modelling of Repeated Measurements and Time-to-Event Data

v1.2.5
GPL-3 | file LICENSE
Authors
Pete Philipson [aut, cre] (<https://orcid.org/0000-0001-7846-0208>), Ines Sousa [aut] (<https://orcid.org/0000-0002-2712-1713>), Peter J. Diggle [aut] (<https://orcid.org/0000-0003-3521-5020>), Paula Williamson [aut] (<https://orcid.org/0000-0001-9802-6636>), Ruwanthi Kolamunnage-Dona [aut] (<https://orcid.org/0000-0003-3886-6208>), Robin Henderson [aut], Graeme L. Hickey [aut] (<https://orcid.org/0000-0002-4989-0054>), Maria Sudell [ctb], Medical Research Council [fnd] (Grant numbers: G0400615 and MR/M013227/1)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.