Description Usage Arguments Value Examples
Samples of eyetracking data are excluded so that the number of frames is evenly divisible by a given bin width. For example, given a bin width of 3 frames, a trial with 181 frames would lose 1 frame. The frames aligned so that a key time value have a specific position in a bin. For example, setting time 0 to position 1 will truncate the times so that time 0 will be the first frame inside of its bin.
1 2 3 4 5 6 7 8 9 10 |
data |
a dataframe of looking data |
bin_width |
the number of items to put in each bin. Default is 3. |
key_time, key_position |
arguments controlling the trimming. The given
time value ( |
time_var |
the name of the column representing time |
... |
grouping variables |
min_time, max_time |
optional arguments controlling the trimming. If
used, the time values are filtered to exclude whole bins of frames before
|
the original dataframe with its time column trimmed to make it easier
to bin time values into groups of bin_width
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | data1 <- tibble(
task = "testing",
id = "test1",
time = -4:6,
frame = seq_along(time))
data2 <- tibble(
task = "testing",
id = "test2",
time = -5:5,
frame = seq_along(time))
# Number of rows per id is divisible by bin width
# and time 0 is center of its bin
bind_rows(data1, data2) %>%
trim_to_bin_width(3, key_time = 0, key_position = 2, time, id) %>%
assign_bins(3, time, id) %>%
group_by(id, .bin) %>%
dplyr::mutate(center_time = median(time))
# And exclude times in bins before some minimum time
bind_rows(data1, data2) %>%
trim_to_bin_width(3, key_time = 0, key_position = 2, time, id,
min_time = -1) %>%
assign_bins(3, time, id)
# And exclude times in bins after some maximum time
bind_rows(data1, data2) %>%
trim_to_bin_width(3, key_time = 0, key_position = 2, time, id,
min_time = -1, max_time = 4) %>%
assign_bins(3, time, id)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.