Learn R Programming

BIOdry (version 0.4)

shiftFrame: MEDS formatting

Description

Ring-data frames (e.g. dplR chronologies) are formatted into multilevel ecological data series (or vice versa).

Usage

shiftFrame(rd, lev.nm = c("plot", "tree", "sample"), which.x = NULL, un = NULL)

Arguments

rd
data.frame. Ring-data frame (see details), or multilevel ecological data series (MEDS).
lev.nm
for the case of ring-data frames, character vector with names of the factor-level columns in the final MEDS, beginning with name of the highest level column and ending with name of the lowest level column. If rd is a MEDS then this argument is ignored.
which.x
for the case of MEDS, character name of the column to be reshaped into a ring-data frame. If NULL then the first numeric column is processed. If rd is a ring-data frame then this argument is ignored.
un
NULL, one, or two character names of SI units to record/transform the processed variables. One character records metric system; two characters with the form c(initial, final) change SI units in the processed data. Defined SI units are micrometers 'mmm', milimeters 'mm', centimeters 'cm', decimeters 'dm', or meters 'm'. If NULL then no metric system is recorded.

Value

rd is a ring-data frame then output is a MEDS. If rd is a MEDS then the output is a ring-data frame (see details).

Details

Correct formatting of ring-data frames requires their row names to be time-units labels (e.g. years). The column names should be dot-separated labels representing the hierarchy of ecological factors, where the higher levels are defined first and the lower levels after. For example, code 'P16106.17' is the column name of tree '17' in plot 'P16106'. SI units of the processed chronologies can also be changed.

Examples

Run this code
##tree-ring MEDS:
data(Prings05,envir = environment())

## Formatting the MEDS into a ring-data frame:
pwide <- shiftFrame(Prings05)
str(pwide)
## Formatting the ring-data frame into a MEDS, and changing SI
## units of the rings from milimeters to micrometers:
plong <- shiftFrame(pwide,un = c('mm','mmm'))
str(plong)

Run the code above in your browser using DataLab