Re: [R] What is the R equivalent of STATA's 'drop' command?

2009-02-10 Thread John C Frain
Try something like rm(list=ls(pattern=y+)) John 2009/2/10 stephen sefick ssef...@gmail.com: 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

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

2009-02-09 Thread jjh21
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

Re: [R] What is the R equivalent of STATA's 'drop' command?

2009-02-09 Thread stephen sefick
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

Re: [R] What is the R equivalent of STATA's 'drop' command?

2009-02-09 Thread Kingsford Jones
See ?[ and its examples Also, section 2.7 of An Introduction to R is a good place to start: http://cran.r-project.org/doc/manuals/R-intro.html#Index-vectors hth, Kingsford Jones On Mon, Feb 9, 2009 at 5:27 PM, jjh21 jjhar...@gmail.com wrote: Hello, I am trying to do some data cleaning in