I have a data frame that looks like this:
> head(Data1A)
Prime Target CorrectAnswer Accuracy RT Block TrialType
1 bezaaid barkme PseudoWord 1 3450 Block 1 NA
2 hazen lemmet Word 1 1108 Block 1 NA
3 bergtoppen slavin Word 1 1160 Block 1 NA
4 wekte gareel Word 1 1250 Block 1 NA
5 zessen studio Word 1 557 Block 1 NA
6 nauwkeurige hotens PseudoWord 1 882 Block 1 NA
As you can see, the column TrialType has to be filled, and I need a conditional statement to do it. I know what I want and I wrote in down in pseudocode as best as I could, but I am light years away of being able to implement this in the right syntax. Any help is much appreciated.
The Pseudocode:
For each cell in Data1A$TrialType if the corresponding cell in Data1A$Block is equal to Block 2 or Block 3 and the corresponding row in Data1A$CorrectAnswer is equal to Word OR if the corresponding cell in Data1A$Block is equal to “Block 4” or “Block 5” and the corresponding cell in Data1A$CorrectAnswer is equal to PseudoWord then the corresponding cell in TrialType will be equal to Regular else if the corresponding cell in Data1A$Block is equal to Block 1 or Block 6 OR if the corresponding cell in Data1A$Block is equal to Block 2 or Block3 and the corresponding row in Data1A$CorrectAnswer is equal to pseudoWord OR if the corresponding cell in Data1A$Block is equal to Block 4 or Block 5 and the corresponding cell in Data1A$CorrectAnswer is equal to Word then the corresponding cell in Data1A$TrialType is equal to Random
I hope this is understandable. I will be checking in case there are doubts regarding my intentions with the pseudocode.
I really get a headeach to simplify your logic here.
But This should work.
I generate some data
Then I implement your logic:
Here the result