diff --git a/R/check_ppt_n.R b/R/check_ppt_n.R
index 343487d..253975d 100644
--- a/R/check_ppt_n.R
+++ b/R/check_ppt_n.R
@@ -11,7 +11,6 @@
time_rep <- duplicated(rle(data$time)$values)
if (sum(trial_rep) > 0) stop("multiple duplicated trials detected. Have you forgotten to specify the participant_ID?")
- if (sum(time_rep) > 0) stop("multiple duplicated timepoints detected. Have you forgotten to specify the participant_ID?")
participant_ID = "participant_ID"
data <- cbind(data, participant_ID = c("NOT A VALID ID")) # just assign a value
diff --git a/R/plot_spatial.R b/R/plot_spatial.R
index 0935ea7..1cd867f 100644
--- a/R/plot_spatial.R
+++ b/R/plot_spatial.R
@@ -1,11 +1,13 @@
#' Plot raw data and fixations
#'
-#' A tool for visualising raw eye-data, processed fixations, and saccades. Can use all three data types. Fixations can be labeled
+#' A tool for visualising raw eye-data, processed fixations, and saccades. Can use all three data types together and independently. Fixations can be labeled
#' in the order they were made. Can overlay areas of interest (AOIs) and customise the resolution.
#'
-#' @param data A dataframe of either fixation data (from fix_dispersion) or raw data
-#' @param data_type Whether data is a fixation ("fix") raw data ("raw"), or saccade ("sac")
+#' @param raw_data data in standard raw data form (time, x, y, trial)
+#' @param fix_data data output from fixation function
+#' @param sac_data data output from saccade function
#' @param AOIs A dataframe of areas of interest (AOIs), with one row per AOI (x, y, width_radius, height). If using circular AOIs, then the 3rd column is used for the radius and the height should be set to NA.
+#' @param trial_number can be used to select particular trials within the data
#' @param bg_image The filepath of an image to be added to the plot, for example to show a screenshot of the task.
#' @param res resolution of the display to be shown, as a vector (xmin, xmax, ymin, ymax)
#' @param flip_y reverse the y axis coordinates (useful if origin is top of the screen)
@@ -17,32 +19,33 @@
#'
#' @examples
#' data <- combine_eyes(HCL)
-#'
+#' data <- data[data$pNum == 118,]
#' # plot the raw data
-#' plot_spatial(data = data[data$pNum == 118,], data_type = "raw")
+#' plot_spatial(raw_data = data[data$pNum == 118,])
+#'
+#' # plot both raw and fixation data together
+#' plot_spatial(raw_data = data, fix_data = fixation_dispersion(data))
#'
-#' # add in AOIs
-#' plot_spatial(data = data[data$pNum == 118,], data_type = "raw", AOIs = HCL_AOIs)
+#' #plot one trial
+#' plot_spatial(raw_data = data, fix_data = fixation_dispersion(data), trial_number = 1)
#'
#' @import ggplot2
#' @import ggforce
#' @importFrom magick image_read
#'
-plot_spatial <- function(data = NULL,
- data_type = NULL,
+plot_spatial <- function(raw_data = NULL,
+ fix_data = NULL,
+ sac_data = NULL,
AOIs = NULL,
+ trial_number = NULL,
bg_image = NULL,
res = c(0,1920,0,1080),
flip_y = FALSE,
show_fix_order = TRUE,
plot_header = FALSE) {
- if (is.null(data_type) == TRUE) {
- # input data for both fixations and raw data
- stop("Type of data not specified. Use `data_type = 'fix'` for fixations `data_type = 'raw'` for raw data, or 'sac' for saccades")
-
- }
+ if(!is.null(trial_number) & !is.numeric(trial_number)) stop("trial_number input expected as numeric values")
final_g <- ggplot()
@@ -53,30 +56,42 @@ plot_spatial <- function(data = NULL,
if (is.null(AOIs)==FALSE) final_g <- add_AOIs(AOIs, final_g)
# add raw data
+ if (is.null(raw_data)==FALSE) {
+
+ if(!is.null(trial_number)) {
+ raw_data <- raw_data[raw_data$trial %in% trial_number,]
+ if(nrow(raw_data) == 0) stop("no trial found for raw data. Check the data has the trials")
+ }
- if (data_type == "raw") final_g <- add_raw(data, final_g)
+ final_g <- add_raw(raw_data, final_g)
+ }
# PLOT FIXATION DATA
- if (data_type == "fix") {
+ if (is.null(fix_data)==FALSE) {
+
+ if(!is.null(trial_number)) {
+ fix_data <- fix_data[fix_data$trial %in% trial_number,]
+ if(nrow(fix_data) == 0) stop("no trial found for fixation data. Check the data has the trials")
+ }
- data$fix_n <- seq_len(nrow(data))
- x <- data$x
- y <- data$y
- disp_tol <- data$disp_tol
- duration <- data$duration
- fix_n <- data$fix_n
+ fix_data$fix_n <- seq_len(nrow(fix_data))
+ x <- fix_data$x
+ y <- fix_data$y
+ disp_tol <- fix_data$disp_tol
+ duration <- fix_data$duration
+ fix_n <- fix_data$fix_n
final_g <-
final_g +
- geom_circle(data = data,
- aes(x0 = x, y0 = y, r = disp_tol/2, fill = duration),
- alpha = .2)
+ geom_circle(data = fix_data,
+ aes(x0 = x, y0 = y, r = disp_tol/2, fill = duration),
+ alpha = .2)
if (show_fix_order == TRUE) {
final_g <-
final_g +
- geom_label(data = data,
+ geom_label(data = fix_data,
aes(x = x, y = y, label = fix_n),
hjust = 1,
vjust = 1,
@@ -88,16 +103,21 @@ plot_spatial <- function(data = NULL,
}
# PLOT SACCADE DATA
- if (data_type == "sac"){
+ if (is.null(sac_data)==FALSE){
- origin_x <- data$origin_x
- origin_y <- data$origin_y
- terminal_x <- data$terminal_x
- terminal_y <- data$terminal_y
+ if(!is.null(trial_number)) {
+ sac_data <- sac_data[sac_data$trial %in% trial_number,]
+ if(nrow(sac_data) == 0) stop("no trial found for saccade data. Check the data has the trials")
+ }
+
+ origin_x <- sac_data$origin_x
+ origin_y <- sac_data$origin_y
+ terminal_x <- sac_data$terminal_x
+ terminal_y <- sac_data$terminal_y
final_g <-
final_g +
- geom_segment(data = data,
+ geom_segment(data = sac_data,
aes(x = origin_x, y = origin_y, xend = terminal_x, yend = terminal_y),
colour = "blue",
arrow = arrow(length = unit(0.5, "cm")),
@@ -169,7 +189,7 @@ add_raw <- function(dataIn, ggplot_in){
size = 1,
na.rm = TRUE)
- return(ggplot_in)
+ return(ggplot_in)
}
# function to add AOIs
diff --git a/docs/404.html b/docs/404.html
index c159b2b..f9ea8bf 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -17,7 +17,6 @@
-
-
-
-
-
-
-
-Animating eyetools data • eyetools
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Skip to contents
-
-
-
-
-
eyetools
-
-
0.6.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-library ( eyetools )
-library ( gganimate )
-#> Warning: package 'gganimate' was built under R version 4.2.3
-#> Loading required package: ggplot2
-#> Warning: package 'ggplot2' was built under R version 4.2.3
-library ( tidyverse )
-#> ── Attaching packages ─────────────────────────────────────── tidyverse
-#> 1.3.2 ──
-#> ✔ tibble 3.2.1 ✔ dplyr 1.1.2
-#> ✔ tidyr 1.3.0 ✔ stringr 1.5.0
-#> ✔ readr 2.1.3 ✔ forcats 0.5.2
-#> ✔ purrr 1.0.2
-#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
-#> ✖ dplyr ::filter() masks stats ::filter()
-#> ✖ dplyr ::lag() masks stats ::lag()
-In this article, we offer examples of how eyetools data can be used
-with the gganimate package.
-
-
Plotting raw data with lag
-
-
This animation takes raw data (of a single trial), transforms it into
-a larger dataset with plot-specific parameters, and then provides an
-animation of the participant’s gaze. The lag feature highlights the path
-taken and slowly fades to allow more data to be presented
-
-
-
-data <- example_counterbalance [ example_counterbalance $ trial == 3 ,] |> # take a random trial
- interpolate ( ) |>
- smoother ( ) |>
- mutate ( id = seq ( 1 , n ( ) ) , # add an ID column to original dataset,
- type = "original" ,
- size = 10 , # specify initial size
- alpha = 1 ) |> # specify initial alpha
- mutate ( time = time - min ( time ) )
-
-#bind the original dataset to a mid and end state too
-data_2 <- rbind ( data ,
- data |> # create second version of the dataset - this is the tail
- mutate ( type = "mid_state" ,
- time = time + 45 ,
- size = size * 0.5 ,
- alpha = alpha * 0.2 ) ,
-
- data |>
- mutate ( type = "end_state" ,
- time = time + 300 , # this determines the length of the tail and the final state
- alpha = 0 ) )
-
-# pass this combined dataset to ggplot & animate
-plot_animate <- data_2 |>
- ggplot ( aes ( x = x , y = y , group = id ,
- size = size , alpha = alpha ) ) +
- # add a background image
- annotation_raster ( magick :: image_read ( "../data/HCL_sample_image.jpg" ) ,
- xmin = 0 ,
- xmax = 1920 ,
- ymin = 0 ,
- ymax = 1080 ) +
- geom_point ( colour = "red" ) +
- transition_components ( time ) +
- scale_size_identity ( ) +
- scale_alpha_identity ( ) +
- lims ( x = c ( 0 , 1920 ) , y = c ( 0 , 1080 ) )
-
-animate ( plot_animate ,
- duration = 14 )
-
-
-
-## To save an animation
-#anim_save("point_lag.gif", plot_animate, height = 1080, width = 1920, duration = round(max(data_2$time)/1000),
-# end_pause = 5)
-
-
-
Plotting AOI entries over raw data
-
-
-#data <- example_raw_WM |>
-# interpolate() |>
-# smoother()
-#
-#AOIs_WM
-#
-#data_plot <- data |>
-# filter(trial == 1) |>
-# mutate(in_AOI = case_when(between(x, AOIs_WM$x[1], AOIs_WM$x[1] + AOIs_WM$width_radius[1]) ~ TRUE,
-# between(x, AOIs_WM$x[2], AOIs_WM$x[2] + AOIs_WM$width_radius[1]) ~ TRUE,
-# between(x, AOIs_WM$x[3], AOIs_WM$x[3] + AOIs_WM$width_radius[1]) ~ TRUE,
-# between(x, AOIs_WM$x[4], AOIs_WM$x[4] + AOIs_WM$width_radius[1]) ~ TRUE,
-# .default = FALSE)) |>
-# mutate(id = seq(1, n()), # add an ID column to original dataset,
-# type = "original",
-# size = 10, # specify initial size
-# alpha = 1) |> # specify initial alpha
-# mutate(time = time - min(time))
-#
-#
-#plot_animate <- data_plot |>
-# ggplot(aes(x = x, y = y,
-# colour = in_AOI
-# )) +
-# geom_point() +
-# ggtitle("{frame_time}")# + # optional; added to illustrate frame time explicitly
-# transition_components(time)
-#
-#animate(plot_animate, duration = round(max(data_plot$time)/100))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1 2.gif b/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1 2.gif
deleted file mode 100644
index 2bb9dd8..0000000
Binary files a/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1 2.gif and /dev/null differ
diff --git a/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1.gif b/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1.gif
deleted file mode 100644
index 2bb9dd8..0000000
Binary files a/docs/articles/Animating-eyetools-data_files/figure-html/unnamed-chunk-2-1.gif and /dev/null differ
diff --git a/docs/articles/analysis_steps.html b/docs/articles/analysis_steps.html
deleted file mode 100644
index 1413ee2..0000000
--- a/docs/articles/analysis_steps.html
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
-
-analysis_steps • eyetools
-
-
-
-
-
-
-
-
-
- Skip to contents
-
-
-
-
-
eyetools
-
-<<<<<<< HEAD
-
0.4.3
-=======
-
0.4.2
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-=======
-library ( eyetools )
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/articles/articles/Animating-eyetools-data.html b/docs/articles/articles/Animating-eyetools-data.html
deleted file mode 100644
index cc8a2bf..0000000
--- a/docs/articles/articles/Animating-eyetools-data.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/docs/articles/eyetools.html b/docs/articles/eyetools.html
index 1bf8e37..62177c0 100644
--- a/docs/articles/eyetools.html
+++ b/docs/articles/eyetools.html
@@ -19,7 +19,6 @@
-
Articles • eyetools Articles • eyetools
@@ -10,7 +10,7 @@
eyetools
- 0.6.1
+ 0.7.0
@@ -24,12 +24,6 @@
Reference
-
- Articles
-
-
Changelog
@@ -43,16 +37,14 @@
diff --git a/docs/articles/package_workflow.html b/docs/articles/package_workflow.html
deleted file mode 100644
index 554be55..0000000
--- a/docs/articles/package_workflow.html
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-
-
-
-
-
-
Package Workflow • eyetools
-
-
-
-
-
-
-
-
-
-
Skip to contents
-
-
-
-
-
eyetools
-
-<<<<<<< HEAD
-
0.4.3
-=======
-
0.4.2
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Steps
-
-
-Make a branch from the master
-Make changes to package components (scripts, data, etc)
-Use load_all()
to make the updates
-available for use.
-Use document()
to update the function
-documentation and NAMESPACE
-Use check()
to make sure there are no errors, correct
-any warnings, etc.
-Commit to github.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/authors.html b/docs/authors.html
index 212f69d..b33620e 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -1,9 +1,5 @@
-<<<<<<< HEAD
-
Authors and Citation • eyetools Authors and Citation • eyetools Authors and Citation • eyetools
@@ -14,11 +10,7 @@
eyetools
-<<<<<<< HEAD
-
0.4.3
-=======
-
0.5.0
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
+
0.7.0
@@ -27,18 +19,11 @@
- Reference
+ Get started
-<<<<<<< HEAD
-
- Articles
-
+
+ Reference
-=======
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
Changelog
@@ -52,18 +37,18 @@
@@ -72,25 +57,12 @@ Authors
Citation
-<<<<<<< HEAD
- Beesley T (2022).
-eyetools: Tools for eye data analysis .
-R package version 0.4.3, https://tombeesley.github.io/eyetools/ .
-
- @Manual{,
- title = {eyetools: Tools for eye data analysis},
- author = {Tom Beesley},
- year = {2022},
- note = {R package version 0.4.3},
- url = {https://tombeesley.github.io/eyetools/},
-=======
- Tom Beesley, (). {eyetools}: Tools for eye data analysis. R package version 0.5.0. https://tombeesley.github.io/eyetools
+ Tom Beesley and Matthew Ivory, (). {eyetools}: Tools for eye data analysis. R package version 0.7.0. https://tombeesley.github.io/eyetools/
@Manual{,
title = {{eyetools}: Tools for eye data analysis},
- author = {Tom Beesley},
- note = {R package version 0.5.0},
- url = {https://tombeesley.github.io/eyetools},
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
+ author = {Tom Beesley and Matthew Ivory},
+ note = {R package version 0.7.0},
+ url = {https://tombeesley.github.io/eyetools/},
}
On this page
@@ -98,7 +70,7 @@ Citation
-
-
Processing fixations
-
-
The function fixation_dispersion()
is a dispersion-based algorithm for identifying fixations, based on the algorithm described in Salvucci and Goldberg (2000). Passing raw data to this will return a data frame with the fixations ordered by trial and by fixation sequence, with the averaged x and y coordinates, timestamps and duration. The “min_dur” parameter will restrict to fixations over a certain duration. The “disp_tol” parameter sets the tolerance for the dispersion of data within a fixation. Exploratory analysis of the data will be needed to find suitable values for these.
-
-raw_data_f <- filter ( raw_data , trial <= 3 ) # get a sample of trials
-
-fixation_dispersion ( raw_data_f , min_dur = 120 , disp_tol = 100 )
-
## trial fix_n start end duration x y prop_NA min_dur disp_tol
-## 1 1 1 0 230 230 937 535 0.000 120 100
-## 2 1 2 273 460 187 170 500 0.000 120 100
-## 3 1 3 643 1180 537 1743 534 0.000 120 100
-## 4 1 4 1306 1426 120 252 503 0.243 120 100
-## 5 1 5 1536 1656 120 131 530 0.243 120 100
-## 6 1 6 1660 1816 156 135 533 0.000 120 100
-## 7 2 1 0 230 230 938 539 0.000 120 100
-## 8 2 2 273 407 134 201 515 0.000 120 100
-## 9 2 3 410 767 357 143 522 0.000 120 100
-## 10 2 4 940 1070 130 1696 527 0.000 120 100
-## 11 2 5 1073 1247 174 1739 535 0.000 120 100
-## 12 3 1 0 167 167 941 543 0.000 120 100
-## 13 3 2 210 533 323 159 521 0.000 120 100
-## 14 3 3 623 743 120 1673 519 0.243 120 100
-## 15 3 4 747 1097 350 1732 547 0.000 120 100
-## 16 3 5 1187 1307 120 211 543 0.243 120 100
-
The function fixation_VTI()
is an inverse saccade-based algorithm and offers an alternative algorithm for identifying fixations. The saccade detection is based on the “velocity threshold identification” algorithm (Salvucci and Goldberg, 2000) and then checks the dispersion of the fixations. As with fixation_dispersion()
, passing raw data will return an ordered data frame by trial and fixation event.
-
-fixation_VTI ( raw_data_f , min_dur = 120 , disp_tol = 100 , min_dur_sac = 20 )
-
## trial fix_n start end duration x y min_dur disp_tol
-## 1 1 1 0 227 227 938.5558 534.7634 120 100
-## 2 1 2 263 460 197 173.3073 499.6146 120 100
-## 3 1 3 653 1173 520 1744.0544 534.4384 120 100
-## 4 1 4 1570 1810 240 132.9872 530.3760 120 100
-## 5 2 1 0 224 224 939.2441 539.4135 120 100
-## 6 2 2 283 763 480 156.2593 519.9607 120 100
-## 7 2 3 953 1247 294 1722.0600 531.8271 120 100
-## 8 3 1 0 190 190 935.5209 542.3868 120 100
-## 9 3 2 207 530 323 158.8915 521.1675 120 100
-## 10 3 3 657 1093 436 1719.7962 541.7855 120 100
-## 11 3 4 1220 1353 133 215.9420 543.5276 120 100
-
It is also possible to compare_algorithms()
. This returns a plot (if desired) that shows the fixations detected (in terms of time) for each algorithm in each trial and returns by default a dataframe of the percentage of data tagged as a fixation, the number of fixations, as well as the correlation of whether timepoints are classified as a fixation. The stored object that results from compare_algorithms()
is a list of three. Item 1 is the same printed dataframe seen below. The second object is a further list of the correlations made using cor.test()
(of which the values are stored in object one), and the final object is the data required to reproduce the plot.
-
-comparison <- compare_algorithms ( raw_data_f , min_dur = 120 , disp_tol = 100 , min_dur_sac = 20 )
-
-
## algorithm trial percent fix_n corr.r corr.p corr.t
-## 1 vti 1 61.31261 4 0.7942199 6.036655e-127 31.39707
-## 2 dispersion 1 69.94819 6 0.7942199 6.036655e-127 31.39707
-## 3 vti 2 79.94652 3 0.8979390 1.178382e-134 39.35023
-## 4 dispersion 2 82.08556 5 0.8979390 1.178382e-134 39.35023
-## 5 vti 3 77.56563 4 0.6925860 3.919521e-61 19.60670
-## 6 dispersion 3 77.32697 5 0.6925860 3.919521e-61 19.60670
-
The code used to produce the plots within compare_algorithms()
is shown below
-
-
-
-
Plotting data
-
-
The function plot_spatial()
is a wrapper for a series of ggplot commands to plot both raw data and fixation summaries.
-
-#library(patchwork)
-# patchwork is used here to plot adjacent figures
-
-t_raw <- dplyr :: filter ( example_raw_sac , trial == 9 )
-
-# process fixations
-t_fix <- fixation_dispersion ( t_raw , disp_tol = 100 , min_dur = 150 )
-
-raw_plot <- plot_spatial ( raw_data = t_raw , plot_header = TRUE )
-fixation_plot <- plot_spatial ( raw_data = t_raw , fix_data = t_fix )
-
-#raw_plot/fixation_plot # combined plot with patchwork
-
-
-
Assessing time on areas of interest
-
-
The function AOI_time()
can be used to calculate the time spent on areas of interest. Areas of interest need to be defined by the x and y centre points, and the width and height in pixels:
-
-AOI_regions <- data.frame ( matrix ( nrow = 3 , ncol = 4 ) )
-colnames ( AOI_regions ) <- c ( "x" , "y" , "width_radius" , "height" )
-
-AOI_regions [ 1 ,] <- c ( 960 , 540 , 300 , 300 ) # X, Y, W, H - square
-AOI_regions [ 2 ,] <- c ( 200 , 540 , 300 , 300 ) # X, Y, W, H - square
-AOI_regions [ 3 ,] <- c ( 1720 , 540 , 300 , 300 ) # X, Y, W, H - square
-
AOI_time()
uses the fixation data as input to the function. In this example we are finding the time spent in 3 rectangular regions across the first 10 trials:
-
-
## trial AOI_1 AOI_2 AOI_3
-## 1 1 230 337 537
-## 2 2 230 487 304
-## 3 3 167 473 477
-## 4 4 283 370 349
-## 5 5 246 360 363
-## 6 6 200 217 0
-## 7 7 150 337 797
-## 8 8 180 346 853
-## 9 9 174 260 496
-## 10 10 197 150 826
-
We can include the AOIs within our plot_spatial()
:
-
-t_raw <- filter ( example_raw_sac , trial == 9 ) # single trial for plotting purposes
-
-# process fixations
-t_fix <- fixation_dispersion ( t_raw , disp_tol = 100 , min_dur = 150 )
-
-plot_spatial ( raw_data = t_raw , fix_data = t_fix , AOIs = AOI_regions )
-
-
We can also define AOIs as circles by specifying the radius in the 3rd column and setting the 4th column to NA:
-
-AOI_regions <- data.frame ( matrix ( nrow = 3 , ncol = 4 ) )
-colnames ( AOI_regions ) <- c ( "x" , "y" , "width_radius" , "height" )
-
-AOI_regions [ 1 ,] <- c ( 960 , 540 , 150 , NA ) # X, Y, R - circle
-AOI_regions [ 2 ,] <- c ( 200 , 540 , 300 , 300 ) # X, Y, W, H - square
-AOI_regions [ 3 ,] <- c ( 1720 , 540 , 300 , 300 ) # X, Y, W, H - square
-
-t_raw <- filter ( example_raw_sac , between ( trial ,1 ,10 ) )
-
-# process fixations
-t_fix <- fixation_dispersion ( t_raw , disp_tol = 100 , min_dur = 150 )
-
-plot_spatial ( raw_data = t_raw , fix_data = t_fix , AOIs = AOI_regions )
-
-
Circular AOIs are also handled by AOI_time and will produce different results to comparable rectangular AOIs. Here fixation 5 falls outside of the circular AOI, but within the region of the rectangular AOI:
-
-AOI_regions <- data.frame ( matrix ( nrow = 2 , ncol = 4 ) )
-colnames ( AOI_regions ) <- c ( "x" , "y" , "width_radius" , "height" )
-
-AOI_regions [ 1 ,] <- c ( 960 , 540 , 150 , NA ) # X, Y, R - circle in centre
-AOI_regions [ 2 ,] <- c ( 960 , 540 , 300 , 300 ) # X, Y, W, H - square in centre
-
-t_raw <- filter ( example_raw_sac , trial == 13 )
-
-# process fixations
-t_fix <- fixation_dispersion ( t_raw , disp_tol = 100 , min_dur = 150 )
-
-plot_spatial ( raw_data = t_raw , fix_data = t_fix , AOIs = AOI_regions )
-
-
-
## trial AOI_1 AOI_2
-## 1 13 180 330
-
-
-
Processing saccades
-
-
The function saccade_VTI()
provides a means of processing the data for saccades, based on a “velocity threshold identification” algorithm, as described in Salvucci and Goldberg (2000). As described above, it is wise to use the smoother()
function on the data first. THe sample rate can be set if known, or can be approximated using the timestamps in the data. The threshold determines the degrees of visual angle per second needed to indicate the presence of a saccadic eye-movement.
-
-
## trialNumber sac_n start end duration origin_x origin_y terminal_x
-## 1 1 1 223 287 64 870.3588 527.6547 177.1630
-## 2 1 2 447 530 83 209.4739 500.0963 1423.6778
-## 3 2 1 230 280 50 843.5225 537.3153 258.2328
-## 4 2 2 757 840 83 184.2432 518.7122 1513.4706
-## 5 3 1 163 217 54 864.0695 538.9868 188.6405
-## 6 3 2 527 550 23 236.2502 533.8763 456.4131
-## 7 3 3 1087 1120 33 1671.8701 542.0387 1278.9085
-## 8 4 1 280 340 60 941.2610 525.2997 167.3127
-## 9 4 2 696 730 34 193.3663 514.7454 638.2664
-## 10 5 1 240 293 53 989.2586 539.9973 1655.2936
-## 11 5 2 646 690 44 1688.9012 545.7763 1023.0553
-## 12 6 1 197 247 50 828.6306 532.1597 194.2109
-## 13 6 2 590 627 37 189.2387 524.2148 865.8235
-## 14 7 1 174 224 50 746.4592 532.5643 238.6413
-## 15 8 1 174 237 63 869.1958 545.3931 205.9854
-## 16 8 2 564 664 100 162.7739 512.4705 1644.4917
-## 17 9 1 170 227 57 880.2617 546.0806 205.5746
-## 18 9 2 474 564 90 216.2176 517.2547 1621.2220
-## 19 10 1 194 254 60 845.9267 539.5713 226.3948
-## 20 10 2 530 624 94 180.4137 519.7535 1595.2826
-## terminal_y mean_velocity peak_velocity
-## 1 494.6964 272.5147 467.6514
-## 2 481.3370 362.4432 625.5313
-## 3 513.4092 288.7795 438.2568
-## 4 514.5291 395.9804 681.8466
-## 5 517.6894 311.9050 487.7608
-## 6 571.9000 237.5178 343.4771
-## 7 558.7318 289.8878 429.8076
-## 8 517.7416 321.6201 504.1717
-## 9 545.7368 322.5088 550.1424
-## 10 541.0273 310.0758 476.9325
-## 11 527.7667 373.8080 574.9975
-## 12 524.7652 314.3620 462.7681
-## 13 511.5511 446.6401 654.1694
-## 14 526.0246 251.9393 359.9658
-## 15 520.0820 263.1169 421.9078
-## 16 553.6281 370.0669 675.9970
-## 17 532.1546 294.4052 473.1296
-## 18 545.1010 390.8524 664.2136
-## 19 524.6715 258.9834 400.2764
-## 20 557.3451 377.0585 673.8068
-
Saccadic eye movements can be plotted alongside other data using the plot_spatial()
function:
-
-t_smooth <- filter ( t_smooth , trial == 8 )
-
-t_fix <- fixation_dispersion ( t_smooth , disp_tol = 100 , min_dur = 150 )
-
-t_sac <- saccade_VTI ( t_smooth , sample_rate = 300 , threshold = 100 )
-
-plot_spatial ( raw_data = t_smooth , fix_data = t_fix , sac_data = t_sac )
-
-
-
diff --git a/docs/logo.png b/docs/logo.png
deleted file mode 100644
index e8eeec3..0000000
Binary files a/docs/logo.png and /dev/null differ
diff --git a/docs/news/index.html b/docs/news/index.html
index d19c664..45a8dd0 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -1,5 +1,5 @@
-
Changelog • eyetools Changelog • eyetools
@@ -10,7 +10,7 @@
eyetools
-
0.6.1
+
0.7.0
@@ -24,12 +24,6 @@
Reference
-
- Articles
-
-
Changelog
@@ -43,13 +37,23 @@
+
+
+
added support for multi-participant data in most functions
+standardised expected data input to functions
+added optional parameter for proportion of time spent to AOI_time()
+fixed smoother() span parameter
+added plots to smoother()
+improved handling of variable order in all functions
+
+added new functions: compare_algorithms(), conditional_transform(), fixation_VTI(), hdf5_to_csv()
+
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 7726252..f0ee63c 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -2,9 +2,8 @@ pandoc: 3.1.11
pkgdown: 2.0.6
pkgdown_sha: ~
articles:
- Animating-eyetools-data: Animating-eyetools-data.html
eyetools: eyetools.html
-last_built: 2024-10-15T15:00Z
+last_built: 2024-10-18T15:02Z
urls:
reference: https://tombeesley.github.io/eyetools/reference
article: https://tombeesley.github.io/eyetools/articles
diff --git a/docs/reference/AOI_seq.html b/docs/reference/AOI_seq.html
index 8f4552d..e8ab193 100644
--- a/docs/reference/AOI_seq.html
+++ b/docs/reference/AOI_seq.html
@@ -1,5 +1,5 @@
-
Sequence analysis of area of interest entries — AOI_seq • eyetools Sequence analysis of area of interest entries — AOI_seq • eyetools
@@ -10,7 +10,7 @@
eyetools
-
0.6.1
+
0.7.0
@@ -24,12 +24,6 @@
Reference
-
- Articles
-
-
Changelog
@@ -43,13 +37,13 @@
-
Analyses the sequence of entries into defined AOI regions across trials. Should be used with fixation data.
+
Analyses the sequence of entries into defined AOI regions across trials. Can only be used with fixation data with a "fix_n" column denoting fixation events.
@@ -94,444 +88,141 @@
-
a long format dataframe containing the sequence of entries into AOIs on each trial
+
a dataframe containing the sequence of entries into AOIs on each trial.
+
+
+
If long is TRUE, then each AOI entry is returned on a new row, if FALSE, then a row per trial is returned with all AOI entries in one character string
Examples
-
fix_d <- fixation_dispersion ( example_raw_WM )
-AOI_seq ( fix_d , AOIs = AOIs_WM )
-#> trial AOI entry_n
-#> 1 1 3 1
-#> 2 1 4 2
-#> 3 1 3 3
-#> 4 1 2 4
-#> 5 1 4 5
-#> 6 1 2 6
-#> 7 2 4 1
-#> 8 2 3 2
-#> 9 2 1 3
-#> 10 2 2 4
-#> 11 2 4 5
-#> 12 3 2 1
-#> 13 3 4 2
-#> 14 3 3 3
-#> 15 3 1 4
-#> 16 3 3 5
-#> 17 4 1 1
-#> 18 4 2 2
-#> 19 4 4 3
-#> 20 4 3 4
-#> 21 4 1 5
-#> 22 4 4 6
-#> 23 5 1 1
-#> 24 5 2 2
-#> 25 5 1 3
-#> 26 5 2 4
-#> 27 5 4 5
-#> 28 6 2 1
-#> 29 6 4 2
-#> 30 6 2 3
-#> 31 6 1 4
-#> 32 7 2 1
-#> 33 7 4 2
-#> 34 7 2 3
-#> 35 7 3 4
-#> 36 7 4 5
-#> 37 7 2 6
-#> 38 7 1 7
-#> 39 8 2 1
-#> 40 8 4 2
-#> 41 8 1 3
-#> 42 9 3 1
-#> 43 9 1 2
-#> 44 9 3 3
-#> 45 9 1 4
-#> 46 9 2 5
-#> 47 10 2 1
-#> 48 10 1 2
-#> 49 10 3 3
-#> 50 11 4 1
-#> 51 11 3 2
-#> 52 11 1 3
-#> 53 11 3 4
-#> 54 11 4 5
-#> 55 12 2 1
-#> 56 12 4 2
-#> 57 12 2 3
-#> 58 12 1 4
-#> 59 12 3 5
-#> 60 13 3 1
-#> 61 13 2 2
-#> 62 13 1 3
-#> 63 13 3 4
-#> 64 14 1 1
-#> 65 14 3 2
-#> 66 14 1 3
-#> 67 14 3 4
-#> 68 14 1 5
-#> 69 15 4 1
-#> 70 15 2 2
-#> 71 15 1 3
-#> 72 15 3 4
-#> 73 16 1 1
-#> 74 16 3 2
-#> 75 16 4 3
-#> 76 16 2 4
-#> 77 17 2 1
-#> 78 17 1 2
-#> 79 17 3 3
-#> 80 17 4 4
-#> 81 17 1 5
-#> 82 17 2 6
-#> 83 18 1 1
-#> 84 18 3 2
-#> 85 18 4 3
-#> 86 19 4 1
-#> 87 19 2 2
-#> 88 19 1 3
-#> 89 20 2 1
-#> 90 20 4 2
-#> 91 20 1 3
-#> 92 20 3 4
-#> 93 21 4 1
-#> 94 21 2 2
-#> 95 21 4 3
-#> 96 21 3 4
-#> 97 22 4 1
-#> 98 22 2 2
-#> 99 22 4 3
-#> 100 22 2 4
-#> 101 22 3 5
-#> 102 23 3 1
-#> 103 23 1 2
-#> 104 23 3 3
-#> 105 23 4 4
-#> 106 23 2 5
-#> 107 24 2 1
-#> 108 24 4 2
-#> 109 24 2 3
-#> 110 24 1 4
-#> 111 25 1 1
-#> 112 25 1 2
-#> 113 25 3 3
-#> 114 25 2 4
-#> 115 26 2 1
-#> 116 26 4 2
-#> 117 26 2 3
-#> 118 27 2 1
-#> 119 27 4 2
-#> 120 27 2 3
-#> 121 27 4 4
-#> 122 27 2 5
-#> 123 27 1 6
-#> 124 28 2 1
-#> 125 28 4 2
-#> 126 29 4 1
-#> 127 29 2 2
-#> 128 29 4 3
-#> 129 29 2 4
-#> 130 30 2 1
-#> 131 30 4 2
-#> 132 30 2 3
-#> 133 30 4 4
-#> 134 30 1 5
-#> 135 30 4 6
-#> 136 31 4 1
-#> 137 31 3 2
-#> 138 31 2 3
-#> 139 31 3 4
-#> 140 31 1 5
-#> 141 31 4 6
-#> 142 32 4 1
-#> 143 32 2 2
-#> 144 32 4 3
-#> 145 32 2 4
-#> 146 33 2 1
-#> 147 33 4 2
-#> 148 33 1 3
-#> 149 33 3 4
-#> 150 34 3 1
-#> 151 34 1 2
-#> 152 34 2 3
-#> 153 34 4 4
-#> 154 35 2 1
-#> 155 36 2 1
-#> 156 36 4 2
-#> 157 36 3 3
-#> 158 37 2 1
-#> 159 37 4 2
-#> 160 37 1 3
-#> 161 37 3 4
-#> 162 37 2 5
-#> 163 38 2 1
-#> 164 38 4 2
-#> 165 38 2 3
-#> 166 38 4 4
-#> 167 38 1 5
-#> 168 38 3 6
-#> 169 39 3 1
-#> 170 39 2 2
-#> 171 39 1 3
-#> 172 39 2 4
-#> 173 39 4 5
-#> 174 39 3 6
-#> 175 40 4 1
-#> 176 40 2 2
-#> 177 40 1 3
-#> 178 40 3 4
-#> 179 40 4 5
-#> 180 40 2 6
-#> 181 41 1 1
-#> 182 41 3 2
-#> 183 41 4 3
-#> 184 42 4 1
-#> 185 42 2 2
-#> 186 42 1 3
-#> 187 43 3 1
-#> 188 43 2 2
-#> 189 43 1 3
-#> 190 43 3 4
-#> 191 43 1 5
-#> 192 44 2 1
-#> 193 44 4 2
-#> 194 44 2 3
-#> 195 44 4 4
-#> 196 44 2 5
-#> 197 44 4 6
-#> 198 45 2 1
-#> 199 45 4 2
-#> 200 45 2 3
-#> 201 45 4 4
-#> 202 45 1 5
-#> 203 46 2 1
-#> 204 46 4 2
-#> 205 46 2 3
-#> 206 46 4 4
-#> 207 46 1 5
-#> 208 47 2 1
-#> 209 47 4 2
-#> 210 47 2 3
-#> 211 47 1 4
-#> 212 47 2 5
-#> 213 47 3 6
-#> 214 48 2 1
-#> 215 48 4 2
-#> 216 48 2 3
-#> 217 48 4 4
-#> 218 49 4 1
-#> 219 49 2 2
-#> 220 49 4 3
-#> 221 49 2 4
-#> 222 49 1 5
-#> 223 50 4 1
-#> 224 50 3 2
-#> 225 50 1 3
-#> 226 50 2 4
-#> 227 50 4 5
-#> 228 51 1 1
-#> 229 51 2 2
-#> 230 51 1 3
-#> 231 52 4 1
-#> 232 52 2 2
-#> 233 52 4 3
-#> 234 52 2 4
-#> 235 52 3 5
-#> 236 53 1 1
-#> 237 53 2 2
-#> 238 53 4 3
-#> 239 54 3 1
-#> 240 54 1 2
-#> 241 54 2 3
-#> 242 54 4 4
-#> 243 55 4 1
-#> 244 55 2 2
-#> 245 55 4 3
-#> 246 55 2 4
-#> 247 55 4 5
-#> 248 56 2 1
-#> 249 56 4 2
-#> 250 56 1 3
-#> 251 56 3 4
-#> 252 57 1 1
-#> 253 57 3 2
-#> 254 57 4 3
-#> 255 57 2 4
-#> 256 58 4 1
-#> 257 58 2 2
-#> 258 58 4 3
-#> 259 58 2 4
-#> 260 58 1 5
-#> 261 59 4 1
-#> 262 59 2 2
-#> 263 59 1 3
-#> 264 59 3 4
-#> 265 60 2 1
-#> 266 60 4 2
-#> 267 60 1 3
-#> 268 60 3 4
-#> 269 60 2 5
-#> 270 61 2 1
-#> 271 61 4 2
-#> 272 61 2 3
-#> 273 61 1 4
-#> 274 61 3 5
-#> 275 62 1 1
-#> 276 63 4 1
-#> 277 63 2 2
-#> 278 63 4 3
-#> 279 63 2 4
-#> 280 63 1 5
-#> 281 63 3 6
-#> 282 64 2 1
-#> 283 64 4 2
-#> 284 64 2 3
-#> 285 64 1 4
-#> 286 64 3 5
-#> 287 65 1 1
-#> 288 65 3 2
-#> 289 65 1 3
-#> 290 65 3 4
-#> 291 65 4 5
-#> 292 65 2 6
-#> 293 66 1 1
-#> 294 66 2 2
-#> 295 66 1 3
-#> 296 66 3 4
-#> 297 66 4 5
-#> 298 66 2 6
-#> 299 67 2 1
-#> 300 67 4 2
-#> 301 67 1 3
-#> 302 68 2 1
-#> 303 68 4 2
-#> 304 68 2 3
-#> 305 68 4 4
-#> 306 68 1 5
-#> 307 69 4 1
-#> 308 69 3 2
-#> 309 69 1 3
-#> 310 69 2 4
-#> 311 70 1 1
-#> 312 70 2 2
-#> 313 70 4 3
-#> 314 70 3 4
-#> 315 71 4 1
-#> 316 71 2 2
-#> 317 71 4 3
-#> 318 71 2 4
-#> 319 71 1 5
-#> 320 72 4 1
-#> 321 72 2 2
-#> 322 72 1 3
-#> 323 72 4 4
-#> 324 73 1 1
-#> 325 73 3 2
-#> 326 73 4 3
-#> 327 73 2 4
-#> 328 73 4 5
-#> 329 73 1 6
-#> 330 74 3 1
-#> 331 74 1 2
-#> 332 74 2 3
-#> 333 75 2 1
-#> 334 75 4 2
-#> 335 75 3 3
-#> 336 75 2 4
-#> 337 76 4 1
-#> 338 76 2 2
-#> 339 76 1 3
-#> 340 76 3 4
-#> 341 76 4 5
-#> 342 77 3 1
-#> 343 77 1 2
-#> 344 77 2 3
-#> 345 77 4 4
-#> 346 78 4 1
-#> 347 78 2 2
-#> 348 78 1 3
-#> 349 79 1 1
-#> 350 79 2 2
-#> 351 79 4 3
-#> 352 79 3 4
-#> 353 79 1 5
-#> 354 80 1 1
-#> 355 80 3 2
-#> 356 80 4 3
-#> 357 80 2 4
-#> 358 81 2 1
-#> 359 81 4 2
-#> 360 81 2 3
-#> 361 81 4 4
-#> 362 81 1 5
-#> 363 82 1 1
-#> 364 82 2 2
-#> 365 82 4 3
-#> 366 83 3 1
-#> 367 83 2 2
-#> 368 83 4 3
-#> 369 83 1 4
-#> 370 84 2 1
-#> 371 84 4 2
-#> 372 84 1 3
-#> 373 85 2 1
-#> 374 85 4 2
-#> 375 85 1 3
-#> 376 86 3 1
-#> 377 86 1 2
-#> 378 87 4 1
-#> 379 87 2 2
-#> 380 87 4 3
-#> 381 87 4 4
-#> 382 87 2 5
-#> 383 88 4 1
-#> 384 88 2 2
-#> 385 88 4 3
-#> 386 88 2 4
-#> 387 88 1 5
-#> 388 89 3 1
-#> 389 89 1 2
-#> 390 89 4 3
-#> 391 90 2 1
-#> 392 90 4 2
-#> 393 90 2 3
-#> 394 90 4 4
-#> 395 90 1 5
-#> 396 91 3 1
-#> 397 91 1 2
-#> 398 92 2 1
-#> 399 92 4 2
-#> 400 92 2 3
-#> 401 92 1 4
-#> 402 92 3 5
-#> 403 93 1 1
-#> 404 93 4 2
-#> 405 93 3 3
-#> 406 93 4 4
-#> 407 93 2 5
-#> 408 94 2 1
-#> 409 94 4 2
-#> 410 94 1 3
-#> 411 94 3 4
-#> 412 95 2 1
-#> 413 95 4 2
-#> 414 95 1 3
-#> 415 96 3 1
-#> 416 96 1 2
-#> 417 96 4 3
-#> 418 97 3 1
-#> 419 97 1 2
-#> 420 97 3 3
-#> 421 97 3 4
-#> 422 98 1 1
-#> 423 98 3 2
-#> 424 98 4 3
-#> 425 98 2 4
-#> 426 99 4 1
-#> 427 99 3 2
-#> 428 99 2 3
-#> 429 99 3 4
-#> 430 100 1 1
+ data <- combine_eyes ( HCL )
+fix_d <- fixation_dispersion ( data , participant_ID = "pNum" )
+
+AOI_seq ( fix_d , AOIs = HCL_AOIs , participant_ID = "pNum" )
+#> pNum trial AOI entry_n
+#> 1 118 1 3 1
+#> 2 118 1 1 2
+#> 3 118 1 3 3
+#> 4 118 1 2 4
+#> 5 118 1 3 5
+#> 6 118 1 2 6
+#> 7 118 1 3 7
+#> 8 118 1 1 8
+#> 9 118 1 1 9
+#> 10 118 1 3 10
+#> 11 118 1 1 11
+#> 12 118 1 3 12
+#> 13 118 1 2 13
+#> 14 118 1 3 14
+#> 15 118 2 2 1
+#> 16 118 2 3 2
+#> 17 118 2 1 3
+#> 18 118 2 3 4
+#> 19 118 2 2 5
+#> 20 118 2 1 6
+#> 21 118 2 3 7
+#> 22 118 2 1 8
+#> 23 118 2 3 9
+#> 24 118 2 2 10
+#> 25 118 3 3 1
+#> 26 118 3 2 2
+#> 27 118 3 1 3
+#> 28 118 3 3 4
+#> 29 118 3 2 5
+#> 30 118 3 3 6
+#> 31 118 4 2 1
+#> 32 118 4 3 2
+#> 33 118 4 1 3
+#> 34 118 4 2 4
+#> 35 118 4 1 5
+#> 36 118 4 3 6
+#> 37 118 4 2 7
+#> 38 118 4 1 8
+#> 39 118 4 3 9
+#> 40 118 4 2 10
+#> 41 118 4 1 11
+#> 42 118 4 2 12
+#> 43 118 4 3 13
+#> 44 118 5 3 1
+#> 45 118 5 2 2
+#> 46 118 5 3 3
+#> 47 118 5 2 4
+#> 48 118 5 3 5
+#> 49 118 5 2 6
+#> 50 118 5 3 7
+#> 51 118 6 3 1
+#> 52 118 6 2 2
+#> 53 118 6 1 3
+#> 54 118 6 3 4
+#> 55 118 6 2 5
+#> 56 118 6 1 6
+#> 57 118 6 3 7
+#> 58 119 1 3 1
+#> 59 119 1 1 2
+#> 60 119 1 3 3
+#> 61 119 1 2 4
+#> 62 119 1 1 5
+#> 63 119 1 3 6
+#> 64 119 1 1 7
+#> 65 119 1 2 8
+#> 66 119 1 1 9
+#> 67 119 1 2 10
+#> 68 119 1 3 11
+#> 69 119 1 3 12
+#> 70 119 1 1 13
+#> 71 119 1 3 14
+#> 72 119 2 1 1
+#> 73 119 2 2 2
+#> 74 119 2 3 3
+#> 75 119 2 1 4
+#> 76 119 2 3 5
+#> 77 119 2 1 6
+#> 78 119 2 2 7
+#> 79 119 3 1 1
+#> 80 119 3 2 2
+#> 81 119 3 3 3
+#> 82 119 3 2 4
+#> 83 119 3 1 5
+#> 84 119 3 2 6
+#> 85 119 3 1 7
+#> 86 119 3 3 8
+#> 87 119 3 1 9
+#> 88 119 4 1 1
+#> 89 119 4 2 2
+#> 90 119 4 1 3
+#> 91 119 4 3 4
+#> 92 119 4 1 5
+#> 93 119 4 2 6
+#> 94 119 4 1 7
+#> 95 119 4 2 8
+#> 96 119 4 1 9
+#> 97 119 4 3 10
+#> 98 119 4 3 11
+#> 99 119 5 1 1
+#> 100 119 5 2 2
+#> 101 119 5 1 3
+#> 102 119 5 2 4
+#> 103 119 5 1 5
+#> 104 119 5 2 6
+#> 105 119 5 1 7
+#> 106 119 5 3 8
+#> 107 119 5 1 9
+#> 108 119 5 3 10
+#> 109 119 5 1 11
+#> 110 119 5 3 12
+#> 111 119 5 1 13
+#> 112 119 6 3 1
+#> 113 119 6 1 2
+#> 114 119 6 2 3
+#> 115 119 6 3 4
+#> 116 119 6 2 5
+#> 117 119 6 3 6
+#> 118 119 6 2 7
+#> 119 119 6 1 8
+#> 120 119 6 2 9
+#> 121 119 6 1 10
+#> 122 119 6 3 11
diff --git a/docs/reference/AOI_time.html b/docs/reference/AOI_time.html
index aa33ea2..8e4d851 100644
--- a/docs/reference/AOI_time.html
+++ b/docs/reference/AOI_time.html
@@ -1,9 +1,5 @@
-<<<<<<< HEAD
-
Area of interest analysis at the trial level — AOI_time • eyetools Time analysis of area of interest entries — AOI_time • eyetools Time analysis of area of interest entries — AOI_time • eyetools
@@ -14,11 +10,7 @@
eyetools
-<<<<<<< HEAD
-
0.4.3
-=======
-
0.5.0
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
+
0.7.0
@@ -26,19 +18,12 @@
-
- Reference
+
+ Get started
-<<<<<<< HEAD
-
- Articles
-
+
+ Reference
-=======
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
Changelog
@@ -52,55 +37,39 @@
-<<<<<<< HEAD
-
Analyses total time on defined AOI regions across trials. Currently only works with fixation data as the input.
-=======
Analyses total time on defined AOI regions across trials. Works with fixation and raw data as the input (must use one or the other, not both).
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
Usage
-<<<<<<< HEAD
-
AOI_time ( data , AOIs , AOI_names = NULL )
-=======
-
AOI_time (
- fix_data = NULL ,
- raw_data = NULL ,
- AOIs ,
- AOI_names = NULL ,
- sample_rate = NULL
-)
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
+
AOI_time (
+ data ,
+ data_type = NULL ,
+ AOIs ,
+ AOI_names = NULL ,
+ sample_rate = NULL ,
+ as_prop = FALSE ,
+ trial_time = NULL ,
+ participant_ID = "participant_ID"
+)
Arguments
-<<<<<<< HEAD
data
-A dataframe with fixation data (from fix_dispersion)
-
+A dataframe of either fixation data (from fix_dispersion) or raw data
-=======
- fix_data
-A dataframe with fixation data (from fix_dispersion)
+data_type
+Whether data is a fixation ("fix") or raw data ("raw")
-raw_data
-A dataframe with raw data
-
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
AOIs
A dataframe of areas of interest (AOIs), with one row per AOI (x, y, width_radius, height).
@@ -108,239 +77,73 @@
Value
-<<<<<<< HEAD
-
-=======
-
a dataframe containing the time on the passed AOIs for each trial
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
+
a dataframe containing the time on the passed AOIs for each trial. One column for each AOI separated by trial.
+
+
+
Details
+
AOI_time can take either single participant data or multiple participants where there is a variable for unique participant identification.
+The function looks for an identifier named participant_ID
by default and will treat this as multiple-participant data as default,
+if not it is handled as single participant data, or the participant_ID needs to be specified
Examples
-<<<<<<< HEAD
-
-=======
- fix_d <- fix_dispersion ( eyetools :: example_raw_WM )
-AOI_time ( fix_data = fix_d , AOIs = eyetools :: AOIs_WM )
-#> trial AOI_1 AOI_2 AOI_3 AOI_4
-#> 1 1 0 617 583 383
-#> 2 2 384 334 442 583
-#> 3 3 350 325 475 366
-#> 4 4 317 250 250 633
-#> 5 5 782 600 0 159
-#> 6 6 291 734 0 816
-#> 7 7 225 717 175 350
-#> 8 8 275 1009 0 375
-#> 9 9 493 241 775 0
-#> 10 10 433 533 250 0
-#> 11 11 441 0 708 433
-#> 12 12 258 750 225 358
-#> 13 13 451 300 808 0
-#> 14 14 1343 0 384 0
-#> 15 15 284 416 167 267
-#> 16 16 525 425 300 150
-#> 17 17 734 384 408 159
-#> 18 18 650 0 425 300
-#> 19 19 784 300 0 509
-#> 20 20 283 642 250 383
-#> 21 21 0 466 342 825
-#> 22 22 0 567 400 783
-#> 23 23 283 192 483 233
-#> 24 24 366 868 0 300
-#> 25 25 1033 183 491 0
-#> 26 26 0 1316 0 542
-#> 27 27 532 675 0 576
-#> 28 28 0 1242 0 542
-#> 29 29 0 425 0 1042
-#> 30 30 275 567 0 683
-#> 31 31 233 309 726 459
-#> 32 32 0 1082 0 767
-#> 33 33 167 617 292 525
-#> 34 34 600 400 341 250
-#> 35 35 0 1575 0 0
-#> 36 36 0 733 425 468
-#> 37 37 150 982 216 333
-#> 38 38 375 659 267 467
-#> 39 39 267 542 716 150
-#> 40 40 225 859 242 483
-#> 41 41 341 0 592 584
-#> 42 42 408 692 0 550
-#> 43 43 350 283 859 0
-#> 44 44 0 817 0 691
-#> 45 45 558 717 0 474
-#> 46 46 259 726 0 766
-#> 47 47 300 976 267 241
-#> 48 48 0 542 0 458
-#> 49 49 366 666 0 616
-#> 50 50 317 342 233 784
-#> 51 51 1334 534 0 0
-#> 52 52 0 425 208 751
-#> 53 53 666 242 0 667
-#> 54 54 333 341 592 258
-#> 55 55 0 625 0 884
-#> 56 56 416 941 167 175
-#> 57 57 1042 358 258 233
-#> 58 58 167 749 0 717
-#> 59 59 233 876 267 467
-#> 60 60 208 933 208 334
-#> 61 61 333 732 175 576
-#> 62 62 1909 0 0 0
-#> 63 63 234 441 474 650
-#> 64 64 384 859 300 225
-#> 65 65 725 275 509 208
-#> 66 66 682 358 375 258
-#> 67 67 542 640 0 525
-#> 68 68 317 625 0 566
-#> 69 69 300 658 641 258
-#> 70 70 709 351 375 417
-#> 71 71 225 350 0 1149
-#> 72 72 208 741 0 800
-#> 73 73 593 208 275 450
-#> 74 74 767 350 608 0
-#> 75 75 0 1276 217 309
-#> 76 76 208 392 158 574
-#> 77 77 666 275 234 409
-#> 78 78 217 817 0 666
-#> 79 79 374 350 275 275
-#> 80 80 726 275 217 658
-#> 81 81 400 925 0 416
-#> 82 82 317 158 0 633
-#> 83 83 459 259 334 625
-#> 84 84 375 1090 0 375
-#> 85 85 250 941 0 692
-#> 86 86 375 0 1001 0
-#> 87 87 0 500 0 992
-#> 88 88 183 625 0 800
-#> 89 89 691 0 750 317
-#> 90 90 184 659 0 958
-#> 91 91 200 0 1733 0
-#> 92 92 167 533 225 858
-#> 93 93 233 225 534 475
-#> 94 94 333 833 175 317
-#> 95 95 333 858 0 516
-#> 96 96 192 0 1058 234
-#> 97 97 350 0 1257 0
-#> 98 98 616 325 275 184
-#> 99 99 0 476 733 266
-#> 100 100 1999 0 0 0
-AOI_time ( raw_data = eyetools :: example_raw_WM , AOIs = eyetools :: AOIs_WM , sample_rate = 120 )
-#> trial AOI_1 AOI_2 AOI_3 AOI_4
-#> 1 1 17 667 625 425
-#> 2 2 408 375 542 642
-#> 3 3 425 358 600 392
-#> 4 4 400 425 275 683
-#> 5 5 817 742 0 333
-#> 6 6 308 800 0 850
-#> 7 7 283 808 283 400
-#> 8 8 300 1100 0 550
-#> 9 9 550 425 908 0
-#> 10 10 517 775 283 358
-#> 11 11 483 117 742 617
-#> 12 12 275 833 233 358
-#> 13 13 483 325 842 150
-#> 14 14 1542 0 425 0
-#> 15 15 308 467 175 658
-#> 16 16 567 492 325 417
-#> 17 17 800 408 442 200
-#> 18 18 675 450 450 392
-#> 19 19 817 342 275 525
-#> 20 20 400 733 258 550
-#> 21 21 0 500 358 1050
-#> 22 22 25 642 450 817
-#> 23 23 325 358 542 417
-#> 24 24 392 1075 133 333
-#> 25 25 1092 208 500 0
-#> 26 26 33 1383 0 542
-#> 27 27 558 733 0 617
-#> 28 28 0 1292 0 558
-#> 29 29 0 475 92 1225
-#> 30 30 308 617 150 792
-#> 31 31 258 350 800 517
-#> 32 32 0 1158 0 817
-#> 33 33 417 642 325 558
-#> 34 34 642 417 375 275
-#> 35 35 0 1733 0 0
-#> 36 36 233 767 425 517
-#> 37 37 167 1067 217 467
-#> 38 38 400 708 308 500
-#> 39 39 292 600 842 192
-#> 40 40 250 917 242 533
-#> 41 41 375 67 608 617
-#> 42 42 450 750 0 742
-#> 43 43 400 400 1042 25
-#> 44 44 0 1025 133 750
-#> 45 45 592 775 42 550
-#> 46 46 283 800 0 808
-#> 47 47 325 1017 292 267
-#> 48 48 0 733 133 533
-#> 49 49 408 758 125 633
-#> 50 50 392 383 275 833
-#> 51 51 1400 575 0 0
-#> 52 52 108 542 225 817
-#> 53 53 692 417 158 708
-#> 54 54 375 383 625 292
-#> 55 55 0 767 0 1000
-#> 56 56 425 1042 175 242
-#> 57 57 1050 358 283 258
-#> 58 58 233 825 0 900
-#> 59 59 242 942 275 492
-#> 60 60 242 1092 233 350
-#> 61 61 367 792 200 608
-#> 62 62 2017 0 0 0
-#> 63 63 258 500 483 692
-#> 64 64 425 908 317 292
-#> 65 65 842 283 558 250
-#> 66 66 717 383 517 283
-#> 67 67 558 792 33 575
-#> 68 68 467 675 0 800
-#> 69 69 333 700 658 275
-#> 70 70 725 392 392 450
-#> 71 71 242 417 75 1167
-#> 72 72 217 792 0 883
-#> 73 73 650 250 308 483
-#> 74 74 800 358 625 158
-#> 75 75 0 1333 233 375
-#> 76 76 225 475 183 625
-#> 77 77 700 283 250 417
-#> 78 78 375 858 0 708
-#> 79 79 517 508 300 308
-#> 80 80 750 300 250 692
-#> 81 81 500 992 0 475
-#> 82 82 367 225 117 667
-#> 83 83 642 292 333 642
-#> 84 84 400 992 0 442
-#> 85 85 275 975 0 733
-#> 86 86 400 0 892 75
-#> 87 87 0 542 0 1108
-#> 88 88 342 708 58 842
-#> 89 89 733 0 800 333
-#> 90 90 242 692 0 1000
-#> 91 91 200 0 1783 0
-#> 92 92 183 575 250 908
-#> 93 93 275 267 575 575
-#> 94 94 358 858 192 567
-#> 95 95 358 908 0 558
-#> 96 96 233 292 1150 267
-#> 97 97 392 0 1350 0
-#> 98 98 817 358 308 208
-#> 99 99 0 525 800 283
-#> 100 100 2017 0 0 0
-
-#' @importFrom dplyr between
->>>>>>> 2c885122466b442f37615357c203d6a19a203cc7
-
+ data <- combine_eyes ( HCL )
+fix_d <- fixation_dispersion ( data , participant_ID = "pNum" )
+
+# fixation data
+AOI_time ( data = fix_d , data_type = "fix" , AOIs = HCL_AOIs , participant_ID = "pNum" )
+#> pNum trial AOI_1 AOI_2 AOI_3
+#> 1 118 1 3500 1671 5886
+#> 2 118 2 1387 1292 3924
+#> 3 118 3 576 743 2932
+#> 4 118 4 2412 3546 2609
+#> 5 118 5 0 1101 2136
+#> 6 118 6 789 886 2380
+#> 7 119 1 3673 1743 2394
+#> 8 119 2 912 880 1944
+#> 9 119 3 1959 2152 2106
+#> 10 119 4 4288 2043 1293
+#> 11 119 5 4805 3270 2983
+#> 12 119 6 3447 2920 4962
+
+#raw data
+AOI_time ( data = data , data_type = "raw" , AOIs = HCL_AOIs ,
+ sample_rate = 120 , participant_ID = "pNum" )
+#> pNum trial AOI_1 AOI_2 AOI_3
+#> 1 118 1 9050 4283 15050
+#> 2 118 2 3508 3392 10500
+#> 3 118 3 1467 1967 7708
+#> 4 118 4 6050 9358 7308
+#> 5 118 5 242 2883 5908
+#> 6 118 6 2017 2283 6842
+#> 7 119 1 9550 4475 6383
+#> 8 119 2 2333 2600 5450
+#> 9 119 3 5008 5792 6100
+#> 10 119 4 10867 5250 3800
+#> 11 119 5 12500 9242 8008
+#> 12 119 6 8742 7783 12650
On this page
@@ -348,7 +151,7 @@