Skip to content
Prev 310517 / 398506 Next

help with for loop to test for a condition in a vector

I want my for loop to test for the presence of a term in a vector and return
a value to a new vector. I'm not writing it correctly though. Here's what I
have...
+   v = any(x == testfor[i])
+   result[i] = v
+ }
a  b  c  d  e 
NA NA NA NA NA NA NA NA NA NA 

I would like to get....
TRUE TRUE TRUE FALSE FALSE

Thanks,
MVS



-----
MVS
=====
Matthew Van Scoyoc
Graduate Research Assistant, Ecology
Wildland Resources Department & Ecology Center
Quinney College of Natural Resources
Utah State University
Logan, UT
=====
Think SNOW!


--
View this message in context: http://r.789695.n4.nabble.com/help-with-for-loop-to-test-for-a-condition-in-a-vector-tp4649213.html
Sent from the R help mailing list archive at Nabble.com.