Search for file name intersection

I have two data frames. String names in both cases are dates. I want to do this: I want to select all the common rows (having the same dates) in both data frames and create a new data frame containing only these common rows.

Of course, individual columns will be added next to each other.

Can anyone help?

+5
source share
2 answers

Try:

merge(df1, df2, by="row.names")
?merge

You can also use with = 0 instead of "row.names". And BTW, growth names are not a class of R Date, but are signs. I suppose it could be like this:

 cbind( df1[ intersect(rownames(df1), rownames(df2)), ] ,
        df2[ intersect(rownames(df1), rownames(df2)), ] )
+5
source

BondedDust Answer, , , "", (' [''] ') "cbind".

cbind( df1[ intersect(rownames(df1), rownames(df2)), ])
0

All Articles