How to find common rows between two dataframe in R? -


i make new data frame includes common rows of 2 separate data.frame. example:

data.frame 1

1 id300 2 id2345 3 id5456 4 id33 5 id45 6 id54 

data.frame2

1 id832 2 id300 3 id1000 4 id45 5 id984 6 id5456 7 id888 

so want output be:

1 id300 2 id45 3 id5456 

any suggestion please?

common <- intersect(data.frame1$col, data.frame2$col)   data.frame1[common,] # give common rows in data frame 1   data.frame2[common,] # give common rows in data frame 2 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -