Replies: 1 comment 2 replies
-
Hi @san-r a rapid but probably not perfect first reply left_join
right_join
full_join
semi_joinThe first output table of
anti_join
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to create a reference for
join
command with Miller (version 6 beta) equivalent to what is available indplyr
package inR
, which can be seen in the top-right corner of second page at https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf in the "Mutating joins" and "Filtering joins" sub-sections of "Combine Data Sets" section.Suppose we have two two tables as under:
person.csv
weight.csv
Now the join commands:
inner join
R command:
inner_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
mlr --c2p join -j id -l id_p -r id_w -f person.csv weight.csv
R sorts the result in order of left file, whereas Miller sorts in order of right file.
anti-join filter on person table
R command:
anti_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
mlr --c2p join --np --ul -j id -l id_p -r id_w -f person.csv weight.csv
anti-join filter on weight table
R command:
anti_join(weight, person, by=c("id_w" = "id_p"))
Equivalent Miller command:
mlr --c2p join --np --ur -j id -l id_p -r id_w -f person.csv weight.csv
left-join
R command:
left_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
?
right-join
R command:
right_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
?
full-join
R command:
full_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
?
semi-join filter on person table
R command:
semi_join(person, weight, by=c("id_p" = "id_w"))
Equivalent Miller command:
?
semi-join filter on weight table
R command:
semi_join(weight, person, by=c("id_w" = "id_p"))
Equivalent Miller command:
?
Can someone please post the equivalent Miller commands for
left-join
,right-join
,full-join
andsemi-join
commands. The result should output the same rows even if they are in different sort order.Beta Was this translation helpful? Give feedback.
All reactions