Learn R Programming

avstrat (version 0.1.1)

load_geodiva_forms: Load stratigraphic data from GeoDIVA upload forms

Description

load_geodiva_forms() processes and cleans stratigraphic data from GeoDIVA upload forms, specifically a form that includes Station and Sample data and another form that includes the Layer data. It merges these datasets, resolves any conflicts in key fields, and prepares a consolidated dataset for further analysis. The function also extracts and, optionally, prints a list of unique stratigraphic sections.

Usage

load_geodiva_forms(station_sample_upload, layer_upload, verbose = TRUE)

Value

A data frame containing the merged and cleaned stratigraphic data, ready for further analysis.

Arguments

station_sample_upload

data frame created from uploaded GeoDIVA format Station/Sample upload sheet, usually uploaded with readxl::read_xlsx() linked to filepath.

layer_upload

data frame created from uploaded GeoDIVA format Layers upload sheet, usually uploaded with readxl::read_xlsx() linked to filepath.

verbose

Logical. If TRUE (default), prints a message listing the imported stratigraphic sections. Set to FALSE to suppress console output.

Examples

Run this code
# Locate the example Excel files shipped with the package
path_samples <- system.file("extdata", "example_samples_stations_upload_2024.xlsx",
  package = "avstrat"
)
path_layers <- system.file("extdata", "example_layers_upload_2024.xlsx",
  package = "avstrat"
)

# Read them with readxl
library(readxl)
  station_sample_upload <- readxl::read_xlsx(path_samples, sheet = "Data")
  layer_upload <- readxl::read_xlsx(path_layers, sheet = "Data")

  result <- load_geodiva_forms(station_sample_upload, layer_upload)
  head(result)  # result is a data frame

Run the code above in your browser using DataLab