age_corr: Function that corrects chronologies for sudden jumps in time

Description Usage Arguments Value References Examples

View source: R/age_corr.r

Description

Some occurrences in the model results can lead the CumDY function to detect extra year transitions, resulting in sudden jumps in the shell chronology or a start of the chronology at an age beyond 1 year. This function removes these sharp transitions and late onset by adding or subtracting whole years to the age result.

Usage

1
age_corr(resultarray, T_per = 365, plot = TRUE, agecorrection = TRUE)

Arguments

resultarray

Array containing the full results of the optimized growth model

T_per

The period length of one year (in days)

plot

Should the results be plotted? (/codeTRUE/FALSE)

agecorrection

Correct for jumps in age (/codeTRUE) or only for starting time (/codeFALSE)

Value

An updated and corrected version of resultarray

References

package dependencies: ggplot2 3.2.1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
testarray <- array(NA, dim = c(20, 16, 9)) # Create empty array
# with correct third dimension
windowfill <- seq(10, 100, 10) # Create dummy simulation data 
# (ages) to copy through the array
for(i in 6:length(testarray[1, , 1])){
    testarray[, i, 3] <- c(windowfill,
        rep(NA, length(testarray[, 1, 3]) - length(windowfill)))
    windowfill <- c(NA, windowfill + 31)
}
testarray2 <- age_corr(testarray, 365, FALSE, FALSE) # Apply function on 
array

ShellChron documentation built on July 5, 2021, 5:06 p.m.