Skip to contents

This function adds data from the Swiss Ornithological Institute (SOI) to a package. It includes tags, measurements, and observations based on the provided data frame and directory of data. The function also handles missing directories and updates the package accordingly.

Usage

add_gldp_soi(pkg, gdl, directory_data, allow_empty_o = FALSE, replace = FALSE)

Arguments

pkg

The package object to which the data will be added.

gdl

A data frame containing the SOI data. Must include columns like OrderName, GDL_ID, and other relevant fields for tags, measurements, and observations.

directory_data

A character string specifying the path to the directory where data files are located. This directory is used to locate and match GDL_IDs to their corresponding directories.

allow_empty_o

A logical value indicating whether to allow observations with missing datetime values. Default is FALSE.

replace

A logical value indicating whether to replace existing resources in the package with the new data. Default is FALSE.

Value

The updated package object with the added resources.

Details

The function performs the following steps:

  • Validates the input package and the data frame.

  • Checks and retrieves the directory information for each GDL_ID.

  • Creates tag data, measurements, and observations based on the provided data.

  • Adds these resources to the package, with options to replace existing resources.

  • Updates the package metadata.

Examples

if (FALSE) { # \dontrun{
my_package <- some_package_function()
my_gdl <- data.frame(
  OrderName = c("A", "B"),
  GDL_ID = c("001", "002"),
  # Additional required columns...
)
updated_package <- add_gldp_soi(
  pkg = my_package,
  gdl = my_gdl,
  directory_data = "/path/to/data",
  allow_empty_o = TRUE,
  contributors = list("John Doe" = c("aut", "DataCollector")),
  replace = TRUE
)
} # }