0

I have two data frames:

Dataframe 1

structure(list(ID = c(71, 72, 73, 74, 75, 76, 78, 79, 80), Group = c("ANA", 
"ANA", "HUN", "HAR", "ANNA", "HOP", "HOP", "HUN", "ANNA")), row.names = c(NA, 9L), class = "data.frame")

and

Dataframe 2

structure(list(ID = c(72, 78, 80), Dist = c(3224, 61189, 934), 
    DistN = c("Simwell", "Lola", "Chan")), row.names = c(NA, 
3L), class = "data.frame")

I want to add the "Dist" and "DistN" columns from df2 into df1, ensuring that the ID's for each observation are matched up (so I know they are the same datapoint). Only a portion of the datapoints from df1 are represented in df2, those that are not represented (i.e. 71, 73-76, 79) can just remain blank in the df1 "Dist" and "DistN" columns.

0 Answers0