[R] subset

Marc Schwartz marc_schwartz at comcast.net
Mon Mar 26 17:10:22 CEST 2007


On Mon, 2007-03-26 at 17:02 +0200, Sergio Della Franca wrote:
> Dear R-Helpers,
> 
> I want to make a subset from my data set.
> 
> I'd like to perform different condition for subset.
> 
> I.e.:
> 
> I like to create a subset when:
> - var1=0
> - var2=0
> - var3 is different from 2.
> 
> How can i develop a subset under this condition?
> 
> Thank you in advance.
> 
> Sergio Della Franca.

See ?subset

Something along the lines of the following should work:

  NewDF <- subset(DF, (var1 == 0) & (var2 == 0) & (var 3 != 0))

HTH,

Marc Schwartz



More information about the R-help mailing list