data.trim: Trim the data

Description Usage Arguments Details Value Author(s) See Also

View source: R/data_manipulation.R


Trim the data according to event number or time


data.trim(t, data, trimmed = F)

data.trim.d(d, data, trimmed = F)



Time of interest to pause/stop the study, which could be an interim stage or the final stage.


There are two possible structures allowed for this input data. The first type needs to have trimmed=F and include variables: a treatment variable with "experimental" denoting treatment group, cnsr variable with value 1 denoting censoring, ct variable denoting event time from the origin of the study, which equals the sum of entering time enterT and the survival time (time to event or censoring). A dataset simulated from from R package nphsim should fit the first type well enough (see the example1). The second type can be any data.frame or data.table output from a data.trim function, including variables: ct denoting event time from the origin of the study or the sum of entering time and the survival time, survival denoting the survival time or time to event/censoring, delta as an event indicator, enterT as entering time (example 2). For the second type, we set trimmed=T to avoid extra computations, but should be fine if trimmed=F.


Whether this data has been trimmed by data.trim or data.trim.d before.


Event counts to pause/stop the study.


data.trim is to trim the data upto t, data.trim.d is to trim the data upto the cound d.


Note that data.trim only outputs a data.table odered by ct, the event/censoring time since the start of the study (calendar scale), including variables in the input data.table/frame data, and additional/updated variables of event indicator delta, ct, follow-up time survival since the enrollment. data.trim.d outpus a list of two components. The first component is the data censored with d events have been observed, ordered by ct, the event/censoring time since the start of the study (calendar scale). The second component is the time of the stopping point when d events have been observed.


Lili Wang

See Also

lilywang1988/IAfrac documentation built on March 11, 2021, 11:53 a.m.