[R] The contrary of command %in%
Christos Hatzis
christos at silicoinsights.com
Thu Apr 20 16:55:06 CEST 2006
A flexible way for doing this is to define logical vectors for the types of
samples that you want to include or exclude. You can then use logical
negation to select the complementary set:
inSet1 <- HData$H < 1.3
inSet2 <- HData$H < 8 & Hdata$DBH > 20
HDataPart1 <- Hdata[!inSet1, ]
HDataPart2 <- Hdata[!inSet2, ]
-Christos
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ghislain Vieilledent
Sent: Thursday, April 20, 2006 8:55 AM
To: r-help at stat.math.ethz.ch
Subject: [R] The contrary of command %in%
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
More information about the R-help
mailing list