rtry_join_left | R Documentation |
This function merges two data frames or data tables based on a specified common column and
returns all records from the left data frame (x
) together with the matched records
from the right data frame (y
), while discards all the records in the right data frame
that does not exist in the left data frame. In other words, this function performs a left join
on the two provided data frames or data tables.
rtry_join_left(x, y, baseOn, showOverview = TRUE)
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 |
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
.
This function makes use of the merge
function
within the base
package.
rtry_join_outer
, rtry_bind_col
, rtry_bind_row
# 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
# add a column Latitude to the data table with Longitude based on the common
# identifier ObservationID
lon <- rtry_select_anc(data_TRY_15160, 60)
lat <- rtry_select_anc(data_TRY_15160, 59)
georef <- rtry_join_left(lon, lat, baseOn = ObservationID)
# Expected messages:
# dim: 97 2
# col: ObservationID Longitude
#
# dim: 98 2
# col: ObservationID Latitude
#
# dim: 97 3
# col: ObservationID Longitude Latitude
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.