Learn R Programming

reconstructr (version 1.1.1)

padding_value: automatically generate plausible padding values

Description

padding_value is designed to automatically generate acceptable values for the padding_value argument in session_length. It does this by applying a statistical function to the range of inter-event values within the dataset.

Usage

padding_value(sessions, method, fun, ...)

Arguments

sessions
a list of sessions, generated with reconstruct_sessions
method
the method to use to generate the value. Options are "geometric mean", "arithmetic mean", "median" or "other" (see below).
fun
the function to apply to generate padding_value, in the event that you choose "other" for method.
...
additional arguments to pass to fun, or the function called by the method.

Examples

Run this code

#Generate a padding value based on the geometric mean of the known times between events
data("session_dataset")
session_dataset$timestamp <- to_seconds(x = session_dataset$timestamp, format = "%Y%m%d%H%M%S")
events_by_user <- split(session_dataset$timestamp, session_dataset$UUID)
sessions <- reconstruct_sessions(events_by_user)
padding_val <- padding_value(sessions, "geometric mean")
padding_val
#41.07547

Run the code above in your browser using DataLab