Hello everyone,
I am still a beginner so sorry for that very basic question
I am wondering why I am getting that error message in the second code line, while slicing x with c(TRUE, FALSE) works out.
I thought that, ,if one vector is shorter than the other, R will repeat the shorter vector. So I would expect x[TRUE, FALSE] to produce the same result as x[c(TRUE, FALSE)] does?
Thanks for your help!
x<-3:10
x[c(TRUE, FALSE)]
[1] 3 5 7 9
x[TRUE, FALSE]
error in x[TRUE, FALSE] :wrong number of dimensions