I was wondering whether using the | operator would do the same thing as the 'any' function in SPSS?
For example, I have tried to rewrite this SPSS code into R but I'm not getting the same answers:
SPSS:
IF ((any (age, 11, 12, 13, 21, 42, 33)) AND (income2 =
1)) inc_age = 1.
R:
selected_18_19 <- 2017_18[ which(2017_18$age
==
11 | 2017_18$age == 12 | 2017_18$age == 13
| 2017_18$age == 21 | 2017_18$age == 42 |
2017_18$age == 33 & (2017_18$income == 1)),]
I am getting output but the frequencies on the selected cases are different.
Grateful for any suggestions.
Cheers.