Skip to content

problem with subsetting in compating one column with a vector

3 messages · venkata kirankumar, PIKAL Petr, David Freedman

#
Hi

r-help-bounces at r-project.org napsal dne 03.02.2009 09:11:52:
+ (SUBJECTSID,ORGNUMRES))

Error in subset(findings, SUBJECTSID == SUBJECTS1$SUBJECTSID, select = 
c(SUBJECTSID,  : 
  object "findings" not found

Gives me an error. Strange, is it possible that I do not have SUBJECTS1 or 
SUBJECTSID on my computer?

however

subset(iris, subset=iris$Species=="virginica", select=c("Sepal.Length", 
"Petal.Length"))
    Sepal.Length Petal.Length
101          6.3          6.0
102          5.8          5.1
103          7.1          5.9
104          6.3          5.6
105          6.5          5.8
106          7.6          6.6

works as expected

Or you can use
iris[iris$Species=="virginica", c(1,3)]

to get same result without using subset.

Regards
Petr
subset
http://www.R-project.org/posting-guide.html
#
Do you really want to use '==' ?  How about '%in%', as in

findings1<-subset(findings,SUBJECTSID %in% ==SUBJECTS1$SUBJECTSID,
select=c(SUBJECTSID,ORGNUMRES))

David Freedman
dvkirankumar wrote: