Perform an inner join or left join operation on two layers based on n number of primary and foreign keys. Perform joins using dplyr's inner_join and left_join functions.
Arguments
- f_left
layer with primary keys and left table in joins.
- f_right
layer with foreign keys and right table in joins. For non-spatial joins this must be a non-spatial data frame - if it is a spatial data frame (i.e. of class sf) it will be converted to non-spatial.
- j_type
a string specifying the type of join to perform.
"col_inner"
specifies an inner join and"col_left"
specifies a left join.- pk
a character vector of primary keys. The primary and foreign keys do not need to have the same names but the order of the keys matters.
- fk
a character vector of foreign keys. The primary and foreign keys do not need to have the same names but the order of the keys matters.
Value
j_df
A layer joined on primary and foreign keys. Will be of
class sf(i.e. spatial features) if f_left is spatial. Otherwise returns a data frame.