R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("KMsurv-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('KMsurv') Loading required package: survival Loading required package: splines > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "aids" > > ### * aids > > flush(stderr()); flush(stdout()) > > ### Name: aids > ### Title: data from Section 1.19 > ### Aliases: aids > ### Keywords: datasets > > ### ** Examples > > data(aids) > > > > cleanEx(); ..nameEx <- "alloauto" > > ### * alloauto > > flush(stderr()); flush(stdout()) > > ### Name: alloauto > ### Title: data from Section 1.9 > ### Aliases: alloauto > ### Keywords: datasets > > ### ** Examples > > data(alloauto) > > > > cleanEx(); ..nameEx <- "allograft" > > ### * allograft > > flush(stderr()); flush(stdout()) > > ### Name: allograft > ### Title: data from Exercise 13.1, p418 > ### Aliases: allograft > ### Keywords: datasets > > ### ** Examples > > data(allograft) > > > > cleanEx(); ..nameEx <- "azt" > > ### * azt > > flush(stderr()); flush(stdout()) > > ### Name: azt > ### Title: data from Exercise 4.7, p122 > ### Aliases: azt > ### Keywords: datasets > > ### ** Examples > > data(azt) > > > > cleanEx(); ..nameEx <- "baboon" > > ### * baboon > > flush(stderr()); flush(stdout()) > > ### Name: baboon > ### Title: data from Exercise 5.8, p147 > ### Aliases: baboon > ### Keywords: datasets > > ### ** Examples > > data(baboon) > > > > cleanEx(); ..nameEx <- "bcdeter" > > ### * bcdeter > > flush(stderr()); flush(stdout()) > > ### Name: bcdeter > ### Title: data from Section 1.18 > ### Aliases: bcdeter > ### Keywords: datasets > > ### ** Examples > > data(bcdeter) > > > > cleanEx(); ..nameEx <- "bfeed" > > ### * bfeed > > flush(stderr()); flush(stdout()) > > ### Name: bfeed > ### Title: data from Section 1.14 > ### Aliases: bfeed > ### Keywords: datasets > > ### ** Examples > > data(bfeed) > > > > cleanEx(); ..nameEx <- "bmt" > > ### * bmt > > flush(stderr()); flush(stdout()) > > ### Name: bmt > ### Title: data from Section 1.3 > ### Aliases: bmt > ### Keywords: datasets > > ### ** Examples > > data(bmt) > > > > cleanEx(); ..nameEx <- "bnct" > > ### * bnct > > flush(stderr()); flush(stdout()) > > ### Name: bnct > ### Title: data from Exercise 7.7, p223 > ### Aliases: bnct > ### Keywords: datasets > > ### ** Examples > > data(bnct) > > > > cleanEx(); ..nameEx <- "btrial" > > ### * btrial > > flush(stderr()); flush(stdout()) > > ### Name: btrial > ### Title: data from Section 1.5 > ### Aliases: btrial > ### Keywords: datasets > > ### ** Examples > > data(btrial) > > > > cleanEx(); ..nameEx <- "burn" > > ### * burn > > flush(stderr()); flush(stdout()) > > ### Name: burn > ### Title: data from Section 1.6 > ### Aliases: burn > ### Keywords: datasets > > ### ** Examples > > data(burn) > > > > cleanEx(); ..nameEx <- "channing" > > ### * channing > > flush(stderr()); flush(stdout()) > > ### Name: channing > ### Title: data from Section 1.16 > ### Aliases: channing > ### Keywords: datasets > > ### ** Examples > > data(channing) > > > > cleanEx(); ..nameEx <- "drug6mp" > > ### * drug6mp > > flush(stderr()); flush(stdout()) > > ### Name: drug6mp > ### Title: data from Section 1.2 > ### Aliases: drug6mp > ### Keywords: datasets > > ### ** Examples > > data(drug6mp) > > > > cleanEx(); ..nameEx <- "drughiv" > > ### * drughiv > > flush(stderr()); flush(stdout()) > > ### Name: drughiv > ### Title: data from Exercise 7.6, p222 > ### Aliases: drughiv > ### Keywords: datasets > > ### ** Examples > > data(drughiv) > > > > cleanEx(); ..nameEx <- "hodg" > > ### * hodg > > flush(stderr()); flush(stdout()) > > ### Name: hodg > ### Title: data from Section 1.10 > ### Aliases: hodg > ### Keywords: datasets > > ### ** Examples > > data(hodg) > > > > cleanEx(); ..nameEx <- "kidney" > > ### * kidney > > flush(stderr()); flush(stdout()) > > ### Name: kidney > ### Title: data from Section 1.4 > ### Aliases: kidney > ### Keywords: datasets > > ### ** Examples > > data(kidney) > > > > cleanEx(); ..nameEx <- "kidrecurr" > > ### * kidrecurr > > flush(stderr()); flush(stdout()) > > ### Name: kidrecurr > ### Title: Data on 38 individuals using a kidney dialysis machine > ### Aliases: kidrecurr > ### Keywords: datasets > > ### ** Examples > > data(kidrecurr) > > > > cleanEx(); ..nameEx <- "kidtran" > > ### * kidtran > > flush(stderr()); flush(stdout()) > > ### Name: kidtran > ### Title: data from Section 1.7 > ### Aliases: kidtran > ### Keywords: datasets > > ### ** Examples > > data(kidtran) > > > > cleanEx(); ..nameEx <- "larynx" > > ### * larynx > > flush(stderr()); flush(stdout()) > > ### Name: larynx > ### Title: data from Section 1.8 > ### Aliases: larynx > ### Keywords: datasets > > ### ** Examples > > data(larynx) > > > > cleanEx(); ..nameEx <- "lifetab" > > ### * lifetab > > flush(stderr()); flush(stdout()) > > ### Name: lifetab > ### Title: Create cohort life table > ### Aliases: lifetab > ### Keywords: manip > > ### ** Examples > > tis <- c(0, 2, 3, 5, 7, 11, 17, 25, 37, 53, NA) > nsubs <- c(927, 848, 774, 649, 565, 449, 296, 186, 112, 27) > nlost <- c(2, 3, 6, 9, 7, 5, 3, rep(0, 3)) > nevent <- c(77, 71, 119, 75, 109, 148, 107, 74, 85, 27) > > lifetab(tis, nsubs[1], nlost, nevent) nsubs nlost nrisk nevent surv pdf hazard se.surv 0-2 927 2 926.0 77 1.00000000 0.041576674 0.04338028 0.000000000 2-3 848 3 846.5 71 0.91684665 0.076900310 0.08754624 0.009073665 3-5 774 6 771.0 119 0.83994634 0.064820762 0.08362614 0.012058378 5-7 649 9 644.5 75 0.71030482 0.041328830 0.06177924 0.014947215 7-11 565 7 561.5 109 0.62764716 0.030460169 0.05374753 0.015966927 11-17 449 5 446.5 148 0.50580648 0.027943023 0.06621924 0.016592925 17-25 296 3 294.5 107 0.33814834 0.015357331 0.05549793 0.015812197 25-37 186 0 186.0 74 0.21528969 0.007137741 0.04138702 0.013826142 37-53 112 0 112.0 85 0.12963680 0.006149067 0.07643885 0.011358269 53-NA 27 0 27.0 27 0.03125173 NA NA 0.005911869 se.pdf se.hazard 0-2 0.0045368324 0.004938988 2-3 0.0087683603 0.010379868 3-5 0.0055430063 0.007639143 5-7 0.0045695123 0.007120026 7-11 0.0027313326 0.005118250 11-17 0.0020898086 0.005334699 17-25 0.0013852970 0.005231318 25-37 0.0007903745 0.004660447 37-53 0.0006304732 0.006560105 53-NA NA NA > > > > cleanEx(); ..nameEx <- "lung" > > ### * lung > > flush(stderr()); flush(stdout()) > > ### Name: lung > ### Title: data from Exercise 4.4, p120 > ### Aliases: lung > ### Keywords: datasets > > ### ** Examples > > data(lung) > > > > cleanEx(); ..nameEx <- "pneumon" > > ### * pneumon > > flush(stderr()); flush(stdout()) > > ### Name: pneumon > ### Title: data from Section 1.13 > ### Aliases: pneumon > ### Keywords: datasets > > ### ** Examples > > data(pneumon) > > > > cleanEx(); ..nameEx <- "psych" > > ### * psych > > flush(stderr()); flush(stdout()) > > ### Name: psych > ### Title: data from Section 1.15 > ### Aliases: psych > ### Keywords: datasets > > ### ** Examples > > data(psych) > > > > cleanEx(); ..nameEx <- "rats" > > ### * rats > > flush(stderr()); flush(stdout()) > > ### Name: bnct > ### Title: data from Exercise 7.13, p225 > ### Aliases: rats > ### Keywords: datasets > > ### ** Examples > > data(rats) > > > > cleanEx(); ..nameEx <- "std" > > ### * std > > flush(stderr()); flush(stdout()) > > ### Name: std > ### Title: data from Section 1.12 > ### Aliases: std > ### Keywords: datasets > > ### ** Examples > > data(std) > > > > cleanEx(); ..nameEx <- "stddiag" > > ### * stddiag > > flush(stderr()); flush(stdout()) > > ### Name: stddiag > ### Title: data from Exercise 5.6, p146 > ### Aliases: stddiag > ### Keywords: datasets > > ### ** Examples > > data(stddiag) > > > > cleanEx(); ..nameEx <- "tongue" > > ### * tongue > > flush(stderr()); flush(stdout()) > > ### Name: tongue > ### Title: data from Section 1.11 > ### Aliases: tongue > ### Keywords: datasets > > ### ** Examples > > data(tongue) > > > > cleanEx(); ..nameEx <- "twins" > > ### * twins > > flush(stderr()); flush(stdout()) > > ### Name: twins > ### Title: data from Exercise 7.14, p225 > ### Aliases: twins > ### Keywords: datasets > > ### ** Examples > > data(twins) > > > > ### *