Skip to contents

This function takes a data frame and joins it with an EFSA catalog. The EFSA catalog must be itself a data frame.

Usage

enrich(dataframe, catalogue, joinBy, enrichedColumnName)

Arguments

dataframe

data.frame. The data frame to be enriched.

catalogue

data.frame. The data frame that contains the EFSA catalogue to be used for the enrichment. It must contain at least two columns, namely: NAME and CODE.

joinBy

character (string). The variable to be used as the join key.

enrichedColumnName

character (string). The name of the column added to the original data.

Value

The specified data frame enriched with the catalogue data.

Examples

dataframe_ <- iris |> dplyr::rename(CODE = Species)

catalogue_ <- iris |>
  dplyr::rename(CODE = Species) |>
  dplyr::mutate(NAME = "test") |>
  dplyr::select(CODE, NAME) |>
  unique()

enriched_ <- enrich(
  dataframe = dataframe_,
  catalogue = catalogue_,
  joinBy = "CODE",
  enrichedColumnName = "enrichedColumn")