session_length: Counts the length of each session within a set
Description
session_length takes a list of sessions (generated via sessionise)
and calculates the approximate length (in seconds) of each session. See the "session metrics"
vignette for more details.
session_length does not compute the length of sessions that consist of a single event,
unless single_page_sessions is set to true. Instead, it returns the numeric value -1
for those sessions.
the time to use for padding the session length, to accomodate the time spent idling
on the last event in the session or (in the case of one-event sessions) the only event in the session.
preserve_single_events
whether to attempt to calculate values for single page sessions (TRUE), or ignore
them and instead return the value -1 (FALSE). Set to FALSE by default.
strip_last
whether to strip the last event in a session (TRUE) or include it and attempt
to calculate the time spent on it via padding_value. Set to FALSE by default.
Value
a vector of session length counts, in seconds, with -1 for sessions containing a single event
(or not. See the single_page_sessions parameter).
See Also
sessionise, for generating sessions, session_events for
simply counting the number of events in each session, and bounce_rate for calculating
the bounce rate of the session set overall.
#With a sessionised dataset (see ?sessionise for an example)lengths <- session_length(sessions = sessions, padding_value = 200, preserve_single_events = TRUE)