process_varying_aggregation | R Documentation |
A function to aggregate sequence data for the PROCESS study with 3 possible varying event aggregation options.
process_varying_aggregation(df, scheme = 1)
df |
A dataframe that has the sequence data and must contain columns id and date. Date must represent an index date and begin at 0. |
scheme |
Integer value to indicate which varying aggregation to use. Currently there are 3 options. See "Value" section for description of options. |
Returns a data.frame with an additional column, "period", which indicates the sequence event aggregation. The returned data.frame can be passed to pre_aggregated().
scheme = 1 |
Period 1 is the index data, periods 2-5 are grouped by 7 days, and periods 6+ are groubed by 30 days. |
scheme = 2 |
Period 1 is the index data, periods 2+ are grouped by 30 days. |
scheme = 3 |
Period 1-4 are grouped by 7 days, and periods 5+ are groubed by 30 days. |
# Creating sample data; subtracting 1 from date to create an index date test <- data.frame(id = 1, date = row_number(1:365), event = sample(LETTERS, 366, replace = TRUE)) test$date = test$date - 1 process_varying_aggregation(test, scheme = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.