filter out the data on the basis of values from other data frame

i have two data frames df1 and df2, i want to filter out the data from df2 on the basis of values in df1.

df1 <- data.frame(name = c("col1","col17","col19","col22","col3","col4","col6","col8","col9","col11","col13"))

df2 <- data.frame(name = c("col1","col2","col3","col4","col5","col6","col7","col8","col9","col10","col11","col12","col13","col14","col15","col16","col17","col18","col19","col20","col21","col22"),
                     duration = c(70,45,50,50,60,10,70,80,90,100,100,90,80,10,30,20,20,40,40,50,50,100))


the output should be look like

name duration
col1 70
col3 50
col4 50
col6 10
col8 80
col9 90
col11 100
col13 80
col17 20
col19 40
col22 100

merge(df1, df2)

(adding extra text to meet minimum characters required)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.