Suppose I have two data frames as follow
> df1 <- data.frame(f1=c(1,2,3, 2), f2 = c(10, 20, 30, 10), f3=c("A", "B", "B", "A") )
> df1
f1 f2 f3
1 1 10 A
2 2 20 B
3 3 30 B
4 2 10 A
>
> df2 <- data.frame(f1=c(1,3), f2 = c(10, 30) )
> df2
f1 f2
1 1 10
2 3 30
The dataframe df2 is a subset dataframe of df1. Now I want to extract the rows in df1 corresponds to df2, including the column f3. Any suggestion?