Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. T item V1
  2. 1 a 2
  3. 2 a 5
  4. 1 b 1
  5. 2 b 2
  6.  
  7. T item V1
  8. 1 a 2
  9. 2 a 6
  10.  
  11. df1 %>%
  12. left_join(df2, by = c("T", "item")) %>%
  13. mutate(
  14. V1 = coalesce(as.numeric(V1.y), as.numeric(V1.x))
  15. ) %>%
  16. select(-V1.x, V1.y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement