rtry_join_outer {rtry} | R Documentation |
Outer join for two data frames
Description
This function merges two data frames or data tables based on a specified common column and
returns all rows from both data, join records from the left (x
) which have matching
keys in the right data frame (y
). In order words, this functions performs an outer
join on the two provided data frames, i.e. the join table will contain all records from
both data frames or data tables.
Usage
rtry_join_outer(x, y, baseOn, showOverview = TRUE)
Arguments
x |
A data frame or data table to be coerced and will be considered as the data on the left. |
y |
A data frame or data table to be coerced and will be considered as the data on the right. |
baseOn |
The common column used for merging. |
showOverview |
Default |
Value
An object of the same type of the input data. The merged data is by default lexicographically sorted
on the common column. The columns are the common column followed by the remaining columns in
x
and then those in y
.
References
This function makes use of the merge
function
within the base
package.
See Also
rtry_join_left
, rtry_bind_col
, rtry_bind_row
Examples
# Assume a user has obtained two unique data tables, one with the ancillary data
# Longitude and one with Latitude (e.g. using rtry_select_anc()), and would like to
# merge two data tables into one according to the common identifier ObservationID.
# It does not matter if either Longitude or Latitude data has no record
lon <- rtry_select_anc(data_TRY_15160, 60)
lat <- rtry_select_anc(data_TRY_15160, 59)
georef <- rtry_join_outer(lon, lat, baseOn = ObservationID)
# Expected messages:
# dim: 97 2
# col: ObservationID Longitude
#
# dim: 98 2
# col: ObservationID Latitude
#
# dim: 98 3
# col: ObservationID Longitude Latitude