Detect a change in a column, and returns an incremental counter
Source:R/detect_change.R
detect_change.Rd
Mostly used, e.g., in case the ET file does not provide a Trial number column. The function monitors the occurrences of a 'key' value and, when this value appears for the first time, increases a counter by 1. For example, this will return a counter that for the first occurrences of "target" in the "Event" column, thus returning the putative trial number assuming that target is repeated for each iteration. By default, the column to track is filled downward. Also, empty lines are changed to NA. As a final remark, you may need to clean up lines that are not assigned to a trial (sometimes, e.g., the eyetracker needs time to warm up).