Dialog to Convert a Survival Data Set from "Wide" to "Long" Format
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.
Unfold() # called via the R Commander menus
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
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
The Unfold dialog calls the
unfold function, which is somewhat more flexible.
John Fox <firstname.lastname@example.org>
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.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.