pkgdown/analytics.html Skip to contents

Merges two or more GeoLocator Data Package objects into a single combined package. The metadata properties from both packages are merged according to specific rules, and resource data is combined based on their presence in either package.

Usage

merge_gldp(x, y = NULL, ...)

Arguments

x

A GeoLocator Data Package object, or a list of them.

y

A GeoLocator Data Package object.

...

Additional GeoLocator Data Package objects, or lists of them.

Value

A GeoLocator Data Package object containing the merged data from all inputs.

Details

Input formats:

  • merge_gldp(x, y, ...)

  • merge_gldp(list(x, y, ...))

  • merge_gldp(x, list(y, ...))

Resource merging logic:

  • A resource is added even if only one input package contains it.

  • For each resource, rows from available inputs are combined with dplyr::bind_rows().

  • Custom resources (not GeoLocator-DP tables) are dropped from the merged package, with a message naming them.

Check for unique tag_id:

  • The merge aborts if any tag_id is present in both packages. Drop it from one package with select_gldp(), or rename it in every table and in params of one package.

datapackage_id in tags:

  • For the tags resource, each row must have a datapackage_id.

  • Missing datapackage_id values are filled with the package id, so the merge aborts when such a package has no id.

  • The merge aborts if tags$datapackage_id overlaps between the two inputs.

Metadata merging rules:

  • $schema: The latest GeoLocator-DP version, as set by create_gldp(). The source packages' version is not kept on the merged package; it is listed in datapackages$version.

  • title: Combined from both packages, separated by a "/".

  • contributors: Combined from both packages. Entries for the same person (same ORCID in path, or the same name when no ORCID is given) are merged into one, keeping the first entry's name and the union of roles and organization. Each source package's own list is preserved in datapackages$contributors.

  • licenses: Combined, with duplicates removed.

  • record_type: Combined from both packages, with duplicates removed.

  • codeRepository: Combined from both packages, with duplicates removed.

  • datapackages: Carries the merged provenance table described above.

  • relatedIdentifiers: Combined, with duplicates removed, and each unique source datapackage_id (or package id) is added as IsCompiledBy, a DOI without its https://doi.org/ prefix.

  • params: Concatenated from all inputs; every entry must contain a non-empty param$id.

  • created: Set to the current timestamp at the time of merging.

  • All others are dropped.

datapackages provenance table:

  • pkg$datapackages is a one-row-per-source tibble keyed by datapackage_id (pkg$id) and accumulated across sequential merges.

  • It includes key source metadata fields (e.g. title/version/status/access), temporal coverage (temporal_start, temporal_end), taxonomic summary (taxonomic), and resource/sensor counts as numberTags_* columns.

See also

create_gldp() to create package shells and update_gldp() for the derived properties recomputed on the merged package.

Examples

if (FALSE) { # \dontrun{
pkg1 <- read_zenodo("17367319", quiet = TRUE)
pkg2 <- read_zenodo("17257520", quiet = TRUE)

merged <- merge_gldp(pkg1, pkg2)
merged

# List-style input is also supported
merged <- merge_gldp(list(pkg1, pkg2))
} # }