View source: R/check_pretreatment.R
| check_pretreat | R Documentation |
This functions does some check-up on the data frame used for
the tapas::pretreatment_data() function,
which requires that the depth and age scales are continuous.
In other words, for every i-th row, it requires that
CmBot[i] > CmTop[i]
AgeBot[i] > AgeTop[i]
there shouldn't be duplicate values
in the CmTop, CmBot, AgeTop, and AgeBot columns.
check_pretreat(series)
series |
The input data frame. A matrix with the following columns:
|
If any of the following is true:
any CmBot[i] < CmTop[i]
AgeBot[i] < AgeTop[i]
there are duplicate values in one of the columns CmTop, CmBot
...the function returns a fatal error and stops.
The function also fixes a few things:
Add missing samples:
If any CmBot[i] < CmTop[i+1], then
the function adds a new row [j = i+1]
to fill in the missing CmTop and CmBot values.
Thus, the added samples will have CmTop[j] == CmBot[i]
and CmBot[j] == CmTop[i+1].
The new age scale values will be:
AgeTop[j] == AgeBot[i] and AgeBot[j] == AgeTop[i+1].
Check for overlapping sample depths:
If any CmBot[i] > CmTop[i+1], the function flags a warning due to the
presence of overlapping sample depths. To get a data.frame of the
overlapping sample depths, use the tapas::get_overlaps() function.
Check presence of slumps:
If after these checks any AgeTop[i] == AgeBot[i], then
the function removes the flagged rows,
and creates new corrected CmTop and CmBot scales
that exclude slumps,
such that CmBot[i] > CmTop[i]
and CmBot[i] == CmTop[i+1].
A data frame.
Walter Finsinger
get_overlap_depths
co <- tapas::co_char_data
co_check <- tapas::check_pretreat(co)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.