Datasets from "Modelling Survival Data in Medical Research" by Collett
Overview
Datasets for the book entitled "Modelling Survival Data in Medical Research" by Collett (2023) doi:10.1201/9781003282525. The datasets provide extensive examples of time-to-event data.
Install
Health
ERRORexamplesr-devel-linux-x86_64-debian-gcc
Running examples in ‘collett-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: step_s
> ### Title: Utilities
> ### Aliases: step_s as.data.frame.survfit as.data.frame.summary.survfit
> ### predict_coxph_tt predict_coxph_tv plot_coxph_functional
>
> ### ** Examples
>
> step_s(data.frame(g=c(1,1), a=1:2, b=4:5), a, b)
g a b
1 1 0 1
2 1 1 1
3 1 1 4
4 1 2 4
5 1 2 5
> step_s(data.frame(g=c(2,2), a=3:4, b=6:7), a, b)
g a b
1 2 0 1
2 2 3 1
3 2 3 6
4 2 4 6
5 2 4 7
> step_s(data.frame(g=c(1,1,2,2), a=1:4, b=4:7), a, b, group=g)
g a b
1 1 0 1
2 1 1 1
3 1 1 4
4 1 2 4
5 1 2 5
6 2 0 1
7 2 3 1
8 2 3 6
9 2 4 6
10 2 4 7
> library(survival)
Attaching package: ‘survival’
The following objects are masked from ‘package:collett’:
bladder, kidney, lung, myeloma, ovarian
> library(tinyplot)
> sfit1 = survfit(Surv(time,status)~rx, data=survival::colon,
+ subset=etype==1)
> with(as.d
...[truncated]...
+ model="ns",times=times)
> with(rbind(df1,df2),
+ plt(fitted ~ times | model, ymin=lower, ymax=upper, type="ribbon",
+ xlab="Time since diagnosis (days)",
+ ylab="Hazard ratio comparing treated with untreated"))
> with(subset(breast_rfs,status==1), rug(time))
> library(survival)
> liver = transform(collett::liverbase, lbr=NULL)
> liver = tmerge(liver, liver, id=patient, status=event(time,status))
> liver = tmerge(liver,
+ rbind(with(collett::liverbase, data.frame(patient,tstart=0,lbr)),
+ with(collett::lbrdata0, data.frame(patient,tstart=time,lbr))),
+ id=patient, lbr = tdc(tstart,lbr))
> fit3 = coxph(Surv(tstart,tstop,status)~lbr+treat,liver)
> predict_coxph_tv(fit3,data=subset(liver,patient %in% c(1,7)),
+ id="patient")
Error in a$specials[[i]] : subscript out of bounds
Calls: predict_coxph_tv ... survfit.coxph -> model.matrix.coxph -> delete.response -> off
Execution halted- ERROR12 OK, 1 ERROR2026-10-24
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-05-09
- WARNING12 OK, 1 WARNING2026-05-08
Show 1 earlier changeHide 1 earlier change
- OK14 OK2026-03-10
Documentation
- Help pages
- 37 (1 internal)includes a package overview page
- Examples that run
- 80%4 run in a plain check · 1 hold no code
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 11%
Downloads
Repository
Stars over time
1 development-tooling and community-health practice detected across 1 family in the upstream repository
Checks run against github.com/mclements/collett on 2026-10-22.
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.1.2Latest2026-01-20 · current release · diff ↗ ·
added 4 exports
plot_coxph_functional, predict_coxph_tt, predict_coxph_tv, step_s - RR 4.5.0 released · 2025-04-11
- 0.1.02025-01-09
- RR 4.4.0 released · 2024-04-24
Package metadata
- First published
- 2025-01-09
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 94 KB / 34 files
- Download size
- 296 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("collett")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.