jashubbard / edfR

an R package for importing EDF files from Eyelink eyetrackers
23 stars 4 forks source link

feature request: export data to JSON #7

Open silberzwiebel opened 7 years ago

silberzwiebel commented 7 years ago

Hi,

I'm unsure if this is the right place here or if I should file this over at itrackR. I'd like to visualize eye tracking data and artificial gaze data computed by a model by using this visualization utility: https://github.com/ignacioxd/jivui This tool needs the eye tracking data to be stored as JSON. Is this already somehow possible with edfR? If not: Do you want to implement it? Maybe my request can actually already be satisfied by using different R packages. in that case I'm looking forward receiving some hints.

Thanks.

jashubbard commented 7 years ago

Probably not enough demand to add this to edR or itrackR, but all the eye tracking data are stored as dataframes. If you use edf.batch for example, you can access the fixations/saccades/blinks pretty easily, then just convert those to JSON.

x <- edf.batch('path/to/file.edf')
fixes <- x$fixations
saccs <- x$saccades

Just did a quick google search and there appear to be straightforward ways to export a data frame to JSON (http://stackoverflow.com/questions/25550711/convert-data-frame-to-json). Is this what you're looking for?