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 = 2,
startat = 1,
tz = "UTC",
sinfo = "session_code",
combine = TRUE
)
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 index.
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 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.
# Use package-internal list of oTree data frames
oTree <- ioTree::oTree
# Make a data frame of durations
extime(oTree)
#> $mean_duration
#> [1] 2.81
#>
#> $min_duration
#> [1] 0.4
#>
#> $max_duration
#> [1] 6.93
#>
#> $single_durations
#> participant session duration
#> 12 vbhvhozv vd1h01iv 0.40
#> 13 2scvem7a vd1h01iv 0.43
#> 20 7l0hmpcq qyu3qg0q 0.78
#> 10 xx78b3x0 vd1h01iv 1.08
#> 21 ia9rnfvc qyu3qg0q 1.20
#> 11 xmxl46rm vd1h01iv 1.25
#> 15 jxh15obl t0rog7nz 1.73
#> 16 a7dppel1 t0rog7nz 1.98
#> 19 1l5kal0r t0rog7nz 2.18
#> 1 46kxib6w 7bfqtokx 2.32
#> 18 xkobdvuh t0rog7nz 2.37
#> 17 wk247s9w t0rog7nz 2.50
#> 2 iay3dhkn 7bfqtokx 2.55
#> 14 iagvtslv t0rog7nz 2.82
#> 9 ktjz5jli 7bfqtokx 2.88
#> 7 164r1hs4 7bfqtokx 3.53
#> 8 lsl3vbij 7bfqtokx 4.18
#> 5 2d72mfgh 7bfqtokx 5.38
#> 6 rvce7958 7bfqtokx 5.67
#> 3 4zhzdmzo 7bfqtokx 6.78
#> 4 3ttf7yix 7bfqtokx 6.93
#>
#> $messages
#> [1] "Warning: For at least one participant, the experiment only has one page. I.e., the indices for the first and the last page are the same. See $only_one_page for information on this participant/these participants! Participants in this list are not included in the output."
#>
#> $only_one_page
#> [1] "7wa8kk3d" "znri6myc" "ao9kqvqn" "d4sq7zio"
#>
# Show time for one participant
extime(oTree, pcode = "wk247s9w")
#> [1] 2.5