age_corr {ShellChron} | R Documentation |
Function that corrects chronologies for sudden jumps in time
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
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
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
[Package ShellChron version 0.4.0 Index]