[R] The contrary of command %in%

Gabor Csardi csardi at rmki.kfki.hu
Thu Apr 20 16:44:03 CEST 2006


> a <- 1:10
> a
 [1]  1  2  3  4  5  6  7  8  9 10
>  c(1,2,3,11,12,13) %in% a
[1]  TRUE  TRUE  TRUE FALSE FALSE FALSE
> !  c(1,2,3,11,12,13) %in% a
[1] FALSE FALSE FALSE  TRUE  TRUE  TRUE

Is this it?

Gabor
   
On Thu, Apr 20, 2006 at 02:54:39PM +0200, Ghislain Vieilledent wrote:
> Dear r-list,
> 
> I've got a data base:
> > HData[1:10,]
>    NumTree   Site Species Date Age DBH    H IdentTree
> 1        1 Queige  Spruce 2002 184  49 33.5  Queige 1
> 2        2 Queige     Fir 2002  NA   5  4.6  Queige 2
> 3        3 Queige     Fir 2002  25   8  6.6  Queige 3
> 4        4 Queige  Spruce 2002 198  47 32.5  Queige 4
> 5        5 Queige     Fir 2002 200  59 35.3  Queige 5
> 6        6 Queige  Spruce 2002  80  16  9.4  Queige 6
> 7        7 Queige     Fir 2002  NA   5  4.2  Queige 7
> 8        8 Queige     Fir 2002 200  44 32.5  Queige 8
> 9        9 Queige     Fir 2002  NA   5  3.4  Queige 9
> 10      10 Queige  Spruce 2002 167  48 32.8 Queige 10
> ...
> 
> I want to remove particular points determined by
> > HDataPartP<-HData[H<1.30,]
> and
> > HDataPartP2<-HData[H<8&DBH>20,]
> 
> That's why I want to use subset in a close form to:
> HData2<-subset(HData,HData$H>1.30&HData$IdentTree
> "not"%in%HDataPartP2$IdentTree)
> 
> How should I do that ?
> Is there any R-syntax saying "not element of that object" ?
> 
> Thanks for your help.
> 
> Ghislain.
> 
> --
> Ghislain Vieilledent
> 06 24 62 65 07
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK




More information about the R-help mailing list