Skip to content
Prev 169868 / 398506 Next

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

It depends on how the data is set up (I am not an expert), but I have
had good results with the subset function.  subset(x, var!=3 & var!=4)
 this will take the subset of the dataframe x where var is not equal
to 3 or 4.

a <- rnorm(25)
var <- rep(c(1:5), 5)
x <- data.frame(a, var)
subset(x, var!=3 & var!=4)

Is this what you want?

Stephen Sefick
On Mon, Feb 9, 2009 at 7:27 PM, jjh21 <jjharden at gmail.com> wrote: