Learn R Programming

avstrat (version 0.1.1)

load_stratdata_indiv: Load stratigraphic data from individual tables

Description

load_stratdata_indiv() loads necessary data for avstrat from separate station (location), section (section metadata), stratlayer, and sample data. Allows upload of smaller number of tables if data are already joined together (e.g., stations-sections combined, or layers-samples combined). The function also extracts and, optionally, prints a list of unique stratigraphic sections.

Usage

load_stratdata_indiv(
  stations_upload,
  sections_upload,
  layers_upload,
  samples_upload = NULL,
  verbose = TRUE
)

Value

A data frame of layers joined with section and station metadata, plus collapsed sample information:

  • stratlayer_sample: concatenated SampleIDs per layer (separated by "|").

  • SampleID: list column of SampleIDs per layer.

Arguments

stations_upload

A data frame with "station" metadata. The following columns are required in order to work with avstrat functions:

  • station_id: UniqueID for the station.

  • latdd: Location in decimal degrees, in WGS84 datum.

  • longdd: Longitude in decimal degrees, in WGS84 datum.

sections_upload

A data frame with "section" metadata (point to same file as station_upload if already joined). The following columns are required in order to work with avstrat functions:

  • station_id: UniqueID for the station, must match an existing value in station_upload.

  • stratsection_name: Unique identity of the section.

  • stratmeasuremethod: One of "order and thickness" or "start and stop depth".

  • stratlayer_order_start_at_top: Logical, does ordering start at the top (TRUE) or bottom (FALSE)? For "start and stop depth", this defines if the reference "depth" is the top or bottom of the section.

layers_upload

A data frame with "layer" metadata. The following columns are required in order to work with avstrat functions:

  • stratsection_name: Unique identity of the section, must match an existing value in section_upload.

  • stratlayer_name: Unique identifier for the layer.

  • layer_type: A character value from a list for plotting default layer symbols (color). If not provided, plotting functions will need to override default layer_fill mapping. Must be chosen from a validated list:

    • volcanic

    • tephra fall

    • lava

    • intrusion

    • tuff

    • sediment

    • soil

    • peat

    • lacustrine

    • fluvial

    • eolian

    • diamict

    • clay

    • pyroclastic density current

    • pyroclastic surge

    • pyroclastic flow

    • mass wasting

    • debris flow

    • lahar

    • landslide

    • hyperconcentrated flow

    • debris avalanche

    • frozen water

    • ice

    • snow

    • dirty snow

    • plant

    • rock

    • other

    • undifferentiated/undescribed

  • grainsize_top: Grain size at the top of the layer.

  • grainsize_bottom: Grain size at the bottom of the layer.

Grain size values must be chosen from the validated list (White & Houghton, 2006, Geology 34:677–680):

  • "clay" (<1/256 mm)

  • "silt" (1/256-1/16 mm)

  • "very fine sand/ash" (1/16-1/8 mm)

  • "fine sand/ash" (1/8-1/4 mm)

  • "medium sand/ash" (1/4-1/2 mm)

  • "coarse sand/ash" (1/2-1 mm)

  • "very coarse sand/ash" (1-2 mm)

  • "granule/fine lapilli" (2-4 mm)

  • "pebble/medium lapilli" (4-16 mm)

  • "cobble/coarse lapilli" (1.6-6.4 cm)

  • "blocks/bombs/boulders" (>6.4 cm)

  • NA (no data)

If stratmeasuremethod == "order and thickness"

  • stratlayer_order: Integer order of layers within the section.

  • thickness_units: One of "meters", "centimeters", "millimeters".

  • thickness_typical: Numeric value of the typical thickness of a layer.

  • thickness_min: Numeric value of the minimum thickness of a layer.

  • thickness_max: Numeric value of the maximum thickness of a layer. If stratmeasuremethod == "start and stop depth"

  • depth_units: One of "meters", "centimeters", "millimeters".

  • depth_top: Absolute depth of the top of the layer.

  • depth_bottom: Absolute depth of the bottom of the layer.

samples_upload

A data frame with "sample" metadata.

  • stratlayer_name: Unique identifier for the layer, must match an existing value in layer_upload.

  • SampleID: Unique identifier for the sample.

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 <- system.file("extdata", "example_inputs.xlsx",
  package = "avstrat"
)

# Read them with readxl
library(readxl)
  stations <- readxl::read_xlsx(path, sheet = "stations")
  sections <- readxl::read_xlsx(path, sheet = "sections")
  layers <- readxl::read_xlsx(path, sheet = "layers")
  samples <- readxl::read_xlsx(path, sheet = "samples_layer")

  load_stratdata_indiv(stations_upload = stations,
                       sections_upload = sections,
                       layers_upload = layers,
                       samples_upload = samples)

Run the code above in your browser using DataLab