[R] Return Vector Component

frespider frespider at hotmail.com
Thu Nov 1 13:36:16 CET 2012


Hi, 

I am new  R user and I am still learn this fabulous software. I am stuck on
this part. I need to check 2 character vectors
v1 <-
c("age_1","age_2","age_3","age_4","age_5","age_6","height_1","height_2","height_3","height_4","height_5","height_6","height_7","height_8")

and 

v2 <-
c("sex_1","sex_2","sex_3","age_height_1_1","age_height_2_2","age_height_3_3","age_height_4_4","age_height_5_5","age_height_6_6",
         "age_height_1_7","age_height_2_8")

what I really want to do is loop over v2 and check if its interaction
component have any element in v1then return this component (i.e. v2 [4] =
"age_height_1_1" then check v1 which has "age_1" or "height_1"  then return 
"age_height_1_1") .

Is there a way to do that?

Thanks 



--
View this message in context: http://r.789695.n4.nabble.com/Return-Vector-Component-tp4648115.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list