Skip to content
Prev 169853 / 398506 Next

What is the R equivalent of STATA's 'drop' command?

Hello,

I am trying to do some data cleaning in R. I need to drop observations that
take on certain values of a variable. In STATA I might type something like:

drop if <variable name> == 3
drop if <variable name> == 4

Is there an R equivalent of this? I have tried playing around with the
subset command, but it seems a bit clunky. What would an advanced R user's
approach be for something like this?

Thank you!