Learn R Programming

avstrat (version 0.1.1)

add_layer_width: Reformat stratigraphic layer data for polygon plotting

Description

add_layer_width() reshapes stratigraphic layer grainsize data into a "long" format suitable for plotting polygons in a stratigraphic section diagram. It constructs left/right grain size boundaries, gathers them into long format, assigns depth coordinates, and converts grain size text labels into numeric values for plotting with ggstrat().

Usage

add_layer_width(df, grainsize_direction = c("increasing", "decreasing"))

Value

A tibble in long format with original data plus:

  • size_loc: identifier for polygon vertex locations.

  • size_text: original grain size text.

  • depth: numeric depth coordinate.

  • grainsize: numeric grain size code for plotting.

Arguments

df

A data frame containing stratigraphic layer information. The following columns are required:

  • stratsection_name: Unique identity of the section (repeated for each layer).

  • stratlayer_name: Unique identity of the layer.

  • Depth_top, Depth_bottom: Depths in centimeters, as returned by add_depths().

  • 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)

Several legacy abbreviations (e.g. "vca", "vcs") are currently accepted but may be deprecated in future versions.

grainsize_direction

Character string, one of "increasing" or "decreasing". Controls the numeric mapping of grain sizes:

  • "increasing" (default): clay/silt = 1, ..., blocks/bombs/boulders = 10.

  • "decreasing": clay/silt = 10, ..., blocks/bombs/boulders = 1.

Increasing will show coarser units as bigger polygons (more prominent) which is espeically useful for emphasizing more energentic volcanic deposits. Decreasing will show finer (typically more resistive) units as bigger which may better match observed erosional profiles.

Examples

Run this code
library(dplyr)
library(tidyr)
df <- tidyr::tibble(
stratlayer_order = c(1,2),
grainsize_top = c("clay", "coarse sand/ash"),
grainsize_bottom = c( "silt", "medium sand/ash"),
Depth_top = c(0, 10),
Depth_bottom = c(10, 20)
)
add_layer_width(df)

Run the code above in your browser using DataLab