[R] Odp: problem with subsetting in compating one column with a vector
Petr PIKAL
petr.pikal at precheza.cz
Tue Feb 3 10:31:54 CET 2009
Hi
r-help-bounces at r-project.org napsal dne 03.02.2009 09:11:52:
> Hi all,
> I got one problem with "subset()" function
>
> hear i executed:
>
> findings1<-subset(findings,SUBJECTSID==SUBJECTS1$SUBJECTSID,select=c
+ (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
> hear "SUBJECTS1$SUBJECTSID" vector contains nearly "65" values
> the problem is after comparing and subsetting its not giving
>
> all the values related to that instead its giving randam values
>
> and giving warning that:
>
>
>
> Warning message:
> In SUBJECTSID == SUBJECTS1$SUBJECTSID :
> longer object length is not a multiple of shorter object length
>
>
> can any one suggest what I can do to retreave all the related data of
subset
> and store in one object
>
>
> thanks in advance
>
> regards;
> kiran
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
More information about the R-help
mailing list