compare two variables of different length using R -


i need compare values stored in 2 variables.the variable sizes different. example

x = c(1,2,3,4,5,6,7,8,9,10) 

and

y = c(2,6,11,12,13) 

i need answer 2 , 6 present in both variables. need done in r.anyone please.

the intersect function avoids need @mdsumner's simple indexing:

> x = c(1,2,3,4,5,6,7,8,9,10) > y = c(2,6,11,12,13) > intersect(x,y) [1] 2 6 

whole bunch of set operators found here: help(intersect)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -