Learn R Programming

RcmdrPlugin.survival (version 1.3-2)

Unfold-dialog: Dialog to Convert a Survival Data Set from "Wide" to "Long" Format

Description

Converts a survival-analysis data frame from "wide" format, in which time-varying covariates are separate variables, one per occasion, to "long" or counting-process format in which each occasion is a separate row in the data frame.

Usage

Unfold() # called via the R Commander menus

Arguments

Author

John Fox <jfox@mcmaster.ca>

Details

Most of the dialog box is self-explanatory. A time-varying covariate is identified by selecting the variables constituting the covariate in the "wide" version of the data set using the variable-list box at the lower-left; specifying a name to be used for the covariate in the "long" version of the data set; and pressing the Select button. This process is repeated for each time-varying covariate. All time-varying covariates have to be measured on the same occasions, which are assigned times 0, 1, ... in the output data set. If the covariates are to be lagged, this is indicated via the Lag covariates slider near the lower right. The default lag is 0 --- i.e., no lag. The output data set will include variables named start and stop, which give the counting-process start and stop times for each row, and an event indicator composed of the name of the event indicator in the "wide" form of the data set and the suffix .time.

The Unfold dialog calls the unfold function, which is somewhat more flexible.

References

John Fox, Marilia Sa Carvalho (2012). The RcmdrPlugin.survival Package: Extending the R Commander Interface to Survival Analysis. Journal of Statistical Software, 49(7), 1-32. tools:::Rd_expr_doi("10.18637/jss.v049.i07").

See Also

unfold