I am looking at some data from a cognitive task in which each trial contains four items : a visual mask ("premask"), a visual prime ("prime"), a target to which a response is inputted ("target"), and a visual mask ("postmask"). For one participant, I am missing two targets somewhere. They have only 1790 of 1792 'items'(448 trials). Using sum(with(subjectnumber, itemtype == 'Target'), I was able to determine it is two targets rather than primes or masks I am missing in this dataframe, as it returned two less than I expected. The problem now is finding where the deviation from the Premask, Prime, Target, Postmask pattern happens without manually scrolling through all 1790 items. The trials begin and end exactly how I expect them to, so this tells me this occurs somewhere in the middle.
What I need is for R to return the 'item' variable (numerical with range of 1-1790) when the pattern of the 'itemtype' variable (Premask, Prime, Target, Postmask) is broken. I am new to the programming/R world so I'm not sure where I should start. Apologizes in advance if anything is unclear. Any help is appreciated!
item | Item Type |
---|---|
1 | Premask |
2 | Prime |
3 | Target |
4 | Postmask |
5 | Premask |
6 | Prime |
7 | Target |
8 | Postmask |
Aucun commentaire:
Enregistrer un commentaire