I have been struggling with this for some time now and couldn\'t find any way of doing it, so I would be incredibly grateful if you could help! I am a novice in programming
You can use sqldf
package:
library(sqldf)
#dummy data
fixes <- read.table(text="
Order Participant Sentence Fixation StartPosition
1 1 1 1 -6.89
2 1 1 2 -5.88
3 1 1 3 -5.33
4 1 1 4 -4.09
5 1 1 5 -5.36
",header=TRUE)
zones <- read.table(text="
Sentence Zone ZoneStart ZoneEnd
1 1 -8.86 -7.49
1 2 -7.49 -5.89
1 3 -5.88 -4.51
1 4 -4.51 -2.90
",header=TRUE)
#output merged result
res <-
sqldf("SELECT [Order],Participant,f.Sentence,Fixation,StartPosition,Zone
FROM fixes f,zones z
WHERE f.Sentence=z.Sentence AND
f.StartPosition>=z.ZoneStart AND
f.StartPosition