Если я хочу выбрать подмножество данных в R, я могу использовать подмножество функция. Я хотел основывать анализ на данных, которые соответствовали одному из нескольких критериев, например, что определенная переменная была 1, 2 или 3. I tried
myNewDataFrame <- subset(bigfive, subset = (bigfive$bf11==(1||2||3)))
It did always just select values that matched the first of the criteria, here 1. My assumption was that it would start with 1 and if it does evaluate to "false" it would go on to 2 and than to 3, and if none matches the statement after == is "false" and if one of them matches, it is "true".
I got the right result using
newDataFrame <- subset(bigfive, subset = (bigfive$bf11==c(1,2,3)))
But I would like to be able to select data via logical operators, so: why did the first approach not work?