DataActionsbyID {LOGAN} | R Documentation |
Wide format dataset with the sequence of actions by ID
Description
This is a function that translates a long to wide format dataset.
Usage
DataActionsbyID(data, id.var, event.var, name.var.action)
Arguments
data |
A |
id.var |
a vector with the individuals identification. It is a
|
event.var |
a vector with the cleaned concatenate events. See
|
name.var.action |
A character string that will name the new variable of events |
Value
This function returns a data.frame
with the only one entry by
individual identification and a new 'action.var' variable.
Examples
# 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
m0$DataActionsbyID(df, id, new.event.type, "actions")
[Package LOGAN version 1.0.1 Index]