% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AnalysisFunctions.R
\name{aoi_test}
\alias{aoi_test}
\title{Test whether a gaze coordinates are within or outside a rectangular or elliptical AOI.
The data fram aois must contain variables with minimum x, minimum y, maximum x, and maximum y values and
type where rect or rectangle means that the AOI is a rectangle and ellipse or circle that the AOI is an ellipse
The coordinate variables must be named:
     x0 OR xmin:   minimum x value
     x1 OR xmax:   maximum x value
     y0 OR ymin:   minimum y value
     y1 OR ymax:   maximum y value
If a column called name is present, the output for each
AOI will be labelled accordingly. Otherwise, the output will be labelled according to the order of the AOI in the data frame.
The df 'gaze' must contain the variables onset, duration, x, and y.
Latency will be defined as the value in onset of the first detected gaze coordinate in the AOI Make sure
that the timestamps are correct!
The function can be used with gaze data either fixations, saccades, or single samples. Note that the output variables are not equally relevant for all types of
gaze data. For example, both total duration and latency are relevant in many analyses focusing on fixations, but total duration may be less relevant in analyses of
saccades.}
\usage{
aoi_test(gaze, aois, outside = FALSE)
}
\arguments{
\item{gaze}{data frame with each row representing a gaze coordinate from a fixation, saccade, or sample. Must include the variables x, y, duration, and onset. Onset zero should
typically be trial onset}

\item{aois}{data frame with AOIs.}

\item{outside}{If FALSE, summarize data within AOIs. If TRUE, summarize data outside AOIs.}
}
\value{
data frame with total duration, number of occurrences and latency to first detected gaze coordinates for each AOI. Data are in long format.
}
\description{
Test whether a gaze coordinates are within or outside a rectangular or elliptical AOI.
The data fram aois must contain variables with minimum x, minimum y, maximum x, and maximum y values and
type where rect or rectangle means that the AOI is a rectangle and ellipse or circle that the AOI is an ellipse
The coordinate variables must be named:
     x0 OR xmin:   minimum x value
     x1 OR xmax:   maximum x value
     y0 OR ymin:   minimum y value
     y1 OR ymax:   maximum y value
If a column called name is present, the output for each
AOI will be labelled accordingly. Otherwise, the output will be labelled according to the order of the AOI in the data frame.
The df 'gaze' must contain the variables onset, duration, x, and y.
Latency will be defined as the value in onset of the first detected gaze coordinate in the AOI Make sure
that the timestamps are correct!
The function can be used with gaze data either fixations, saccades, or single samples. Note that the output variables are not equally relevant for all types of
gaze data. For example, both total duration and latency are relevant in many analyses focusing on fixations, but total duration may be less relevant in analyses of
saccades.
}
