I'm new to R and learning about subsetting. I have a table and I'm trying to get the size of a subset of the table. My issue is that when I try two different ways I get two different answers. For a table "dat" where I'm trying to select all rows where RMS is 5 and BDS is 2:
dim(dat[(dat$RMS==5) & (dat$BDS==2),])
gives me a different answer than
dim(subset(dat,(dat$RMS==5) & (dat$BDS==2)))
The second one is correct, could someone explain why these are different and why the first one is giving me the wrong answer?
Thanks