[R] subset() for multiple values

Henrique Dallazuanna
Thu, 18 Feb 2010 18:02:18 -0000

Use ' %in%':

Tree.df<-subset(NativeDominant.df,!ID %in%
c("37-R17","37-R18","10-R1","37-R21","37-R24","R7A-R1","3-R1","37-R16"))

On Thu, Feb 18, 2010 at 3:59 PM, chipmaney <chipmaney at hotmail.com>
wrote:
>
> This code works:
>
> subset(NativeDominant.df,!ID=="37-R17")
>
>
> This code does not:
>
>
Tree.df<-subset(NativeDominant.df,!ID==c("37-R17","37-R18","10-R1","37-R21","37-R24","R7A-R1","3-R1","37-R16"))
>
>
>
> how do i get subset() to work on a range of values?
> --
> View this message in context:
http://n4.nabble.com/subset-for-multiple-values-tp1560543p1560543.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O