I am new in R, I have collected eye-tracking data that has the following structure:
Participant Trial Condition Fixation.Start Fixation.End Fixated.Area
P01 T01 Early 4 206 Outside
P01 T01 Early 258 476 Competitor
P01 T01 Early 496 882 Target
P01 T02 Late 4 794 Outside
P01 T02 Late 838 1026 Target
P01 T02 Late 1046 1328 Target
P02 T01 Early 4 168 Outside
P02 T01 Early 232 452 Competitor
P02 T01 Early 494 738 Target
P02 T02 Late 4 176 Outside
P02 T02 Late 238 466 Target
P02 T02 Late 524 632 Competitor
In it, the fixation time to the different areas shown on screen was measured in milliseconds form beginning (Fixiation Start) to end (Fixation End). Each row is a fixation.
What I would like to do is to reshape the data into time bins of 50ms in a new dataframe so that each time bin (row) reflects what area was being fixated at that moment. In other words, I want the new dataframe to look like this:
Participant Trial Condition Time.Bin Fixated.Area
P01 T01 Early 50 Outside
P01 T01 Early 100 Outside
P01 T01 Early 150 Outside
P01 T01 Early 200 Outside
P01 T01 Early 250 Competitor
P01 T01 Early 300 Competitor
P01 T01 Early 350 Competitor
P01 T01 Early 400 Competitor
P01 T01 Early 450 Competitor
P01 T01 Early 500 Target
P01 T01 Early 550 Target
P01 T01 Early 600 Target
P01 T01 Early 650 Target
I think this should be pretty easy to do in R. Any ideas?