CleanActions: Clean events

Description Usage Arguments Value Examples

View source: R/CleanActions_m0.R

Description

This function allows you to clean events in the 'event.type' variable

Usage

1
CleanActions(data, event.type, clear.events)

Arguments

data

A matrix or data.frame where the 'event.type' variable is

event.type

a vector with concatenate events. See ConcatActions function.

clear.events

a vector where all the events to be cleaned are listed. Each element of this vector needs to be of a "event"="" type.

Value

This function returns a data.frame with the "new.event.type" variable that cleaned events from 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"))
df <- m0$ConcatActions(df, c(rlang::quo(event), rlang::quo(event_type)))

# Function demonstration
df.clean <- m0$CleanActions(df, event_type, c("ACER_EVENT_" = ""))
table(df$event.type)
table(df.clean$new.event.type)  # cleaned version

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