表链接 - 图1

    1. workers = fread("
    2. name company
    3. Nick Acme
    4. John Ajax
    5. Daniela Ajax
    6. ")
    7. positions = fread("
    8. name position
    9. John designer
    10. Daniela engineer
    11. Cathie manager
    12. ")
    13. workers %>% inner_join_dt(positions)
    14. workers %>% left_join_dt(positions)
    15. workers %>% right_join_dt(positions)
    16. workers %>% full_join_dt(positions)
    17. # filtering joins
    18. workers %>% anti_join_dt(positions)
    19. workers %>% semi_join_dt(positions)
    20. # To suppress the message, supply 'by' argument
    21. workers %>% left_join_dt(positions, by = "name")
    22. # Use a named 'by' if the join variables have different names
    23. positions2 = setNames(positions, c("worker", "position")) # rename first column in 'positions'
    24. workers %>% inner_join_dt(positions2, by = c("name" = "worker"))
    25. # the syntax of 'on' could be a bit different
    26. workers %>% inner_join_dt(positions2,on = "name==worker")