ConcatActions: Concatenate events

Description Usage Arguments Details Value Examples

View source: R/ConcatActions_m0.R

Description

This function allows you to concatenate event actions from diferent variables in a unique vector.

Usage

1
ConcatActions(data, concat.events)

Arguments

data

A matrix or data.frame where the concatenated events are

concat.events

a vector where all the events are listed. Each element of this vector needs to be of a quo() type.

Details

The output dataset will be identical to the input dataset, except for the addition of one column in the end, called "event.type". Each row of event.type contains the values of concat.events of all the rows.

Value

This function returns a data.frame with the concatenated events in the 'event.type' variable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Data preparation
df <- cp025q01
df$id <- paste(df[, 1], df[, 2], df[, 3], sep = "-")
df <- m0$TrimVar(df, c("event", "event_type", "diag_state"))

# Function demonstration
df.conc <- m0$ConcatActions(df, c(rlang::quo(event), rlang::quo(event_type)))
names(df)
names(df.conc)  # notice the extra variable in the end
table(df.conc$event.type)

derecost/LOGAN documentation built on June 19, 2020, 6:40 p.m.