prepare_data | R Documentation |
Processes a dataset to create user sessions based on time gaps, ordering columns, or actor groupings. It supports different ways to understand order in user behavior and provides flexibility when widening the data.
prepare_data(
data,
actor,
time,
action,
order,
time_threshold = 900,
custom_format = NULL,
is_unix_time = FALSE,
unix_time_unit = "seconds",
unused_fn = dplyr::first
)
data |
A |
actor |
A |
time |
A |
action |
A |
order |
A |
time_threshold |
An |
custom_format |
A |
is_unix_time |
A |
unix_time_unit |
A |
unused_fn |
How to handle extra columns when pivoting to wide format.
See |
A tna_data
object, which is a list
with the following elements:
long_data
: The processed data in long format.
sequence_data
: The processed data on the sequences in wide format,
with actions/events as different variables structured with sequences.
meta_data
: Other variables from the original data in wide format.
statistics
: A list
containing summary statistics: total
sessions, total actions, unique users, time range (if applicable), and
top sessions and user by activities.
Basic functions
build_model()
,
hist.group_tna()
,
hist.tna()
,
import_data()
,
plot.group_tna()
,
plot.tna()
,
plot_frequencies()
,
plot_frequencies.group_tna()
,
plot_mosaic()
,
plot_mosaic.group_tna()
,
plot_mosaic.tna_data()
,
print.group_tna()
,
print.summary.group_tna()
,
print.summary.tna()
,
print.tna()
,
print.tna_data()
,
simulate.tna()
,
summary.group_tna()
,
summary.tna()
,
tna-package
results <- prepare_data(
group_regulation_long, actor = "Actor", time = "Time", action = "Action"
)
print(results$sequence_data)
print(results$meta_data)
print(results$statistics)
data_ordered <- tibble::tibble(
user = c("A", "A", "A", "B", "B", "C", "C", "C"),
order = c(1, 2, 3, 1, 2, 1, 2, 3),
action = c(
"view", "click", "add_cart", "view",
"checkout", "view", "click", "share"
)
)
results_ordered <- prepare_data(
data_ordered, actor = "user", order = "order", action = "action"
)
print(results_ordered$sequence_data)
print(results_ordered$meta_data)
print(results_ordered$statistics)
data_single_session <- tibble::tibble(
action = c(
"view", "click", "add_cart", "view",
"checkout", "view", "click", "share"
)
)
results_single <- prepare_data(data_single_session, action = "action")
print(results_single$sequence_data)
print(results_single$meta_data)
print(results_single$statistics)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.