0

I am very newbie with R. I have two table as follow (data frame)

ID    running_time
1     10
1     2
2     1
2     3
2     4

And another table as

ID    age
1     20
1     NA
2     30
2     NA
2     NA

I would like to extract information for age from table 2 and fullfill each column in table 1. My expected output is

ID    running_time   age 
1     10             20
1     2              20
2     1              30
2     3              30
2     4              30

How could I do it in R? Thanks

Moon Lee
  • 385
  • 5
  • 18
  • 3
    Try: `left_join(df1, df2 %>% na.omit(), by = 'ID') `? – Quinten Oct 21 '22 at 16:24
  • Thanks I will close the question. Could I ask a small question releate to the data above. How to assign group/class for table 1 with condition >25==> group 1 and <25 group 2? – Moon Lee Oct 21 '22 at 16:52

0 Answers0