Im really struggling with my R at the moment. I have a dataset with some amount of questions, and Im investigating the extreme answers given. In a 1-5 scale, thats 1 and 5. For that I wrote a code (Question 1 is called Q1S5):
dat[dat$Condition =='1'$Q1S5 == 1 | dat$Q1S5== 5,]$Extreme1S5 = 1
dat[dat$Condition =='1'$Q1S5 == 2 | dat$Q1S5== 3 | dat$Q1S5== 4,]$Extreme1S5 = 0
Now I want to filter using my column 'Condition' which has value 1 or 2, depending on the condition. I want to investigate condition 1.
I wrote this: dat[dat$Condition=='1',]$Q1S5 == 1 | dat$Q1S5== 5,]$Extreme1S5 = 1
But it doesn't work. I don't know how to do it, can anybody help me?