Description Usage Arguments Value Examples
View source: R/VarTimebyID_m1.R
Extracting the start or end time
1 | VarTimebyID(data, id.var, time.var, event.var, name.var.time, new.name)
|
data |
data frame |
id.var |
vector of unique identification |
time.var |
vector with the time variable |
event.var |
vector with the events |
name.var.time |
name of the time string to filter (ex.: "START_ITEM" or "END_ITEM") |
new.name |
name of the output variable |
a data frame with 'time' replaced with 'new.name'. The variable 'event.var' is dropped.
1 2 3 4 5 6 7 8 9 | # Data preparation
df <- cp025q01
df$id <- paste(df[, 1], df[, 2], df[, 3], sep = "-")
df <- m0$TrimVar(df, c("event", "event_type", "diag_state"))
df <- m0$ConcatActions(df, c(rlang::quo(event), rlang::quo(event_type)))
df <- m0$CleanActions(df, event.type, c("ACER_EVENT_" = ""))
# Function demonstration
m1$VarTimebyID(df, id, time, new.event.type, "START_ITEM", "start")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.