Closed zhezhaozz closed 1 year ago
left_join
now can be passed with expression to by
argument. For example:
left_join(df1, df4, by=:(id = zid))
left_join(df1, df5, by=:([id = zid, pid = fid]))
@left_join
can take the following arguments
@left_join(df1, df3, "id")
@left_join(df1, df2, ["id", "pid"])
@left_join(df1, df4, id == zid)
@left_join(df1, df5, [id == zid, pid == fid])
The parse_join_by
is the function to parse the expression from by
argument, without any string manipulation.
Next steps:
by
to be Nothing;parse_join
parsing engine to handle more DataFrames.leftjoin
arguments;Implemented a different way of doing this in PR #30.
I use this draft PR for self-learning purposes. Do NOT merge this PR.
Implementing join functions, starting with
left_join(df1, df2, by)
. The goal is listed by the following:by
is passed nothing, the function will find common columns to joinby
can be passed with a single string indicating variable nameby
can be passed with a vector of strings indication multi-columns joiningdplyr
in R,by
can take expressions like(id == pid)
to match columns with different names