sum_visits {webtrackR} | R Documentation |
Summarize number of visits by person
Description
sum_visits()
summarizes the number of visits by person within a timeframe
,
and optionally by visit_class
of visit.
Usage
sum_visits(wt, timeframe = NULL, visit_class = NULL)
Arguments
wt |
webtrack data object. |
timeframe |
character. Indicates for what time frame to aggregate visits.
Possible values are |
visit_class |
character. Column that contains a classification of visits.
For each value in this column, the output will have a column indicating the
number of visits belonging to that value. Defaults to |
Value
a data.frame with columns panelist_id
, column indicating the time unit
(unless timeframe
set to NULL
), n_visits
indicating the number of visits,
and a column for each value of visit_class
, if specified.
Examples
## Not run:
data("testdt_tracking")
wt <- as.wt_dt(testdt_tracking)
# summarize for whole period
wt_summ <- sum_visits(wt)
# summarize by week
wt_summ <- sum_visits(wt, timeframe = "week")
# create a class variable to summarize by class
wt <- extract_domain(wt)
wt$google <- ifelse(wt$domain == "google.com", 1, 0)]
wt_summ <- sum_visits(wt, timeframe = "week", visit_class = "google")
## End(Not run)