asWide | R Documentation |
Convert an object to "wide" or "long" form.
asWide(x, ...) ## S3 method for class 'ten' asWide(x, ...) asLong(x, ...) ## S3 method for class 'ten' asLong(x, ...)
x |
An object of class |
... |
Additional arguments (not implemented). |
A new data.table
is returned,
with the data in 'wide' or 'long' format.
There is one row for each time point.
For a ten
object generated from a numeric
or Surv
object,
this has columns:
t |
time. |
e |
number of events. |
n |
number at risk. |
If derived from a survfit
, coxph
or formula
object,
there are additional columns for e
and n
for each covariate group.
Most methods for ten
objects are designed for the 'long' form.
## Not run: data("bmt", package="KMsurv") require("survival") t1 <- ten(c1 <- coxph(Surv(t2, d3) ~ z3*z10, data=bmt)) asWide(t1) ## End(Not run) ## Not run: asLong(asWide(t1)) stopifnot(asLong(asWide(t1)) == ten(ten(t1))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.