Last data update: 2014.03.03

R: Transform Surv object to data matrix with L and R columns
SurvtoLRR Documentation

Transform Surv object to data matrix with L and R columns

Description

Take a Surv object and transforms it into a data matrix with two columns, L and R, representing the left and right points of observed time intervals. For right-censored data, R = NA.

Usage

SurvtoLR(x)

Arguments

x

a Surv object

Details

The input Surv object should be in the form of Surv(L,R,type='interval2'), where R = NA for right-censored data.

Value

A data matrix with two variables:

L

left-points of observed time intervals

R

right-points of observed time intervals

References

Michael P. Fay, Pamela A. Shaw (2010). Exact and Asymptotic Weighted Logrank Tests for Interval Censored Data: The interval R Package. Journal of Statistical Software, 36 1-34.

Examples

library(survival)
L<-c(45,6,0,46)
R<-c(NA,10,7,NA)
y<-Surv(L,R,type='interval2')
SurvtoLR(y)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ICBayes)
Loading required package: HI
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ICBayes/SurvtoLR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SurvtoLR
> ### Title: Transform Surv object to data matrix with L and R columns
> ### Aliases: SurvtoLR
> 
> ### ** Examples
> 
> library(survival)
> L<-c(45,6,0,46)
> R<-c(NA,10,7,NA)
> y<-Surv(L,R,type='interval2')
> SurvtoLR(y)
      L  R
[1,] 45 NA
[2,]  6 10
[3,]  0  7
[4,] 46 NA
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>