workers = fread("
name company
Nick Acme
John Ajax
Daniela Ajax
")
positions = fread("
name position
John designer
Daniela engineer
Cathie manager
")
workers %>% inner_join(positions)
workers %>% left_join(positions)
workers %>% right_join(positions)
workers %>% full_join(positions)
# filtering joins
workers %>% anti_join(positions)
workers %>% semi_join(positions)
# To suppress the message, supply 'by' argument
workers %>% left_join(positions, by = "name")
# Use a named 'by' if the join variables have different names
positions2 = setNames(positions, c("worker", "position")) # rename first column in 'positions'
workers %>% inner_join(positions2, by = c("name" = "worker"))
# the syntax of 'on' could be a bit different
workers %>% inner_join(positions2,on = "name==worker")
Run the code above in your browser using DataLab