Calculate the time spent on the experiment. If not stated otherwise, the calculation only starts at the end of the first page!
extime(
oTree,
pcode = NULL,
plabel = NULL,
group_id = NULL,
seconds = FALSE,
rounded = TRUE,
digits = 2L,
startat = 1L,
tz = "UTC",
sinfo = "session_code",
combine = TRUE
)
This function returns either a single value if only the data of one person is calculated or a list of information on the time several participants spent on the experiment.
In this list, you can find the following information:
- $mean_duration
= The experiment's average duration.
- $min_duration
= The experiment's minimum duration.
- $max_duration
= The experiment's maximum duration.
- $single_durations
= A data frame of all durations that
are used for calculating the min, max, and mean duration.
- $messages
= All important notes to the calculations.
- $only_one_page
= A vector of all individuals who
only have one time stamp.
A list of data frames that were created
by import_otree
.
Character. The value of the participant.code
variable if the time should only be calculated for one specified participant.
Character. The value of the participant.label
variable
if the time should only be calculated for one specified participant.
Integer. The value of the group_id variable if the
time should only be calculated for one specified group. The group_id
variable can be created with make_ids
.
Logical. TRUE
if the output should be in seconds
instead of minutes.
Logical. TRUE
if the output should be rounded.
Integer. The number of digits to which the output
should be rounded.
This parameter has no effect unless rounded = TRUE
.
Integer or character string "real"
Whether the start of the experiment should be taken from the time at
a certain index of each person's vector of page_indexes in
the $Time
data frame or from the time_started
variable in $all_apps_wide
("real"
). Important: If integer,
it represents the position within the page index sequence,
not the numeric value of the page_index
variable.
Character. Time zone.
Character. "session_id"
to use session ID for
additional information in the data frame
of single durations, "session_code"
to use session codes,
or NULL
if no session column should be shown.
Logical. TRUE
if all variables referring to epoch time
should be merged, and all variables referring to participant code should
be merged in case data of several versions of oTree are used.
If FALSE
,
the function returns an error if several oTree versions' data are present.
This functions calculates the time spent on the experiment by using
the variable that refers to the time stamp. If that variable is not
present, the function alternatively uses seconds_on_page2
,
which can be created with the pagesec
function.
# Use package-internal list of oTree data frames
oTree <- gmoTree::oTree
# Show time for one participant
extime(oTree, pcode = "wk247s9w")
# Make a data frame of durations
extime(oTree)
# Make a data frame of durations (beginning from the end of the second page)
extime(oTree, startat = 2)
Run the code above in your browser using DataLab