79650221

Date: 2025-06-02 19:26:56
Score: 1
Natty:
Report link

Here's a solution for this:

# Create new df isolating the two variables of interest AND
# Remove duplicates from df_B based on 'ID'
df_B_distinct <- df_B %>% 
  select(ID, Distance) %>%
  distinct(ID, .keep_all = TRUE)

# Perform the join
result <- df_A %>%
  left_join(df_B_distinct, by = "ID")
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: mchuck