Getting Started with EyeLink Data Analysis in R
#1
R is a programming language for statistical computing and graphics, and can be a powerful tool for processing and analysing gaze and pupilometry data.

EyeLink data can be imported into R in a variety of ways:

1) By reading in a Data Viewer Report. Data Viewer outputs Reports as tab-delimited ASCII files. Reports can be generated at the Trial, Interest Area, Fixation, Saccade, and Sample level (e.g. one row per trial, interest area, sample  etc). Time Series (binning) Reports allow the data to be aggregated over short time windows  (eg 20 or 50 ms bins). Each Report can contain many different variables (columns). For example, Sample Reports can contain columns for Timestamp and Gaze X and Y as well as columns indicating whether the current sample is in a saccade or blink, the index of the fixation / saccade the sample is in, the label of any Interest Area the sample is in, as well as any user generated trial variables (such as trial condition). As such they are often a far richer and more convenient way to analyse ascii data than simply converting the EDF file to ascii. Data Viewer Reports can easily be read into R, and some of the packages listed below take Data Viewer Reports as their input. There are many ways in which you can import Data Viewer Reports into R, the following is just one example:

Code:
data <- read.table('ALL_SampleReport.xls', sep = "\t", na.strings = ".", header = TRUE)

Please note that whether the Data Viewer Report has an .txt or .xls extension makes no difference to the format or content of the report. In both cases the reports are tab-delimited ASCII files.

2) Via an EDF to ASCII conversion tool. Please see the following thread for further details about our conversion tools: Converting EDF Files to ASCII. There are some R packages that have been written to parse the ASCII ouput of our conversion tools (for example gazeR has functions for parsing the output of our ASCII conversion tools), but in general a Data Viewer Sample Report will give richer data and be easier to work with.

3) By directly Importing the EDF Files. EyeLink Data Files (EDF Files) are encoded in a binary format, but our EDF-API (which is installed as part of our Developer's Kit) provides tools that can be used to extract the data. There are a number tools for reading EDF files directly into R using the EDF-API.  eyelinkReader (by Alexander Pastukhov) appears to work well, and produces a rich data structure that is very easy to work with. For further details, including installation instructions, please check the following link:

https://alexander-pastukhov.github.io/eyelinkReader/

The package is now on CRAN: https://cran.r-project.org/package=eyelinkReader

A version of the E&K microsaccade detection algorithm that uses eyelinkReader can be downloaded here:

Microsaccade Analysis for EyeLink Data (Modified Engbert & Kliegl MS_Toolbox_R code)

There are several packages that have been developed by researchers for processing EyeLink data in R. The following list contains examples of some that appear to be relatively stable and actively developed. These have all been developed by researchers outside of SR Research, and have not been tested extensively by the Support Team. Any support issues should be directed to the package developers. 
  • eyelinkReader: A useful tool for reading EDF files directly into R. It can be installed via cran here. An example of its use can be found in the adapted EyeLink_MS_Toolbox_eyelinkReader.R code for microsaccade detection.
  • eyetrackingR: This comprehensive package contains useful tools for the preparation and analysis of gaze data (including data collected using EyeLink eye trackers). It takes a sample report type input and is particularly suited for visual world / time-series analyses.
  • GazeR: Another comprehensive package with several useful functions for processing gaze and pupil data. It can read EDF files directly and also parse EDF files that have been converted to ASCII).
  • popEye: A comprehensive set of R functions for processing reading data. Currently takes ASCII data as input.
  • pupillometryR: A full CRAN package for working with pupil data. Takes ASCII data as input.
If there are other R packages that you find useful please let us know by emailing support@sr-research.com, referencing this thread.