Learn R Programming

D3partitionR (version 0.5.0)

aggregate_sessions_to_path: Aggregate a data.frame in long format with a column containing steps of each session For instance the function can be used with a frame of the form Unique ID - Step - Value 1 - ... -Value N

Description

Aggregate a data.frame in long format with a column containing steps of each session For instance the function can be used with a frame of the form Unique ID - Step - Value 1 - ... -Value N

Usage

aggregate_sessions_to_path(data, step_col = "step", id_col = "ID",
  values_cols = NULL, agg_function_path = sum, agg_function_session = sum,
  sep = "->")

Arguments

data

A dataframe

step_col

The name of the column containig the steps. The steps are assumed to be ordered

id_col

Column containing the unique identifier of each session

values_cols

Names of the other columns to keep. Default: NULL

agg_function_path

Aggregation function on a path level

agg_function_session

Aggregation function on a session level

sep

String used to separate the different steps. Default: "->"

Value

A data.table with the columns specified in count_col, value_cols and one column per step in the path