0

I notice one interesting thing while extracting specific data from my data frame.

When using the following command:

new1 <- total[total$PitchAccent=="H%",]

I get 12 occurrences of "H%".

However, when using:

new2 <- total[total$PitchAccent== c("H%", "L%"),]

I get again 12 occurences of both "H%" and "L%", 8 and 4 accordingly.

That is I somehow lose 4 more occurrences of "H%".

How is that possible?

dgr379
  • 353
  • 3
  • 13
  • 4
    Use `%in%` instead of `==`. You are not doing what you think. – nicola Mar 20 '18 at 15:24
  • 3
    `total[total$PitchAccent%in%c("H%", "L%"),]` is what you need – Onyambu Mar 20 '18 at 15:24
  • 3
    You could investigate what's going wrong by running `total$PitchAccent== c("H%", "L%")` in isolation and looking at the series of TRUE/FALSE you get. The short answer is that you want `%in%` here not `==`. – joran Mar 20 '18 at 15:24

0 Answers0