cumdy {ShellChron}R Documentation

Function to detect year transitions and calculate cumulative age of model results

Description

Takes the result of iterative growth modeling and transforms data from Julian Day (0 - 365) to cumulative day of the shell age by detecting where transitions from one year to the next occur and adding full years (365 days) to simulations in later years.

Usage

cumdy(resultarray, threshold = 5, plotyearmarkers = TRUE)

Arguments

resultarray

Array containing the full results of the optimized growth model

threshold

Artificial threshold value used to recognize peaks in occurrences of year transitions (default = 5)

plotyearmarkers

Should the location of identified year transitions be plotted? TRUE/FALSE

Value

A new version of the resultarray with Julian Day model estimates replaced by estimates of cumulative age of the record in days.

References

package dependencies: zoo 1.8.7

Examples

testarray <- array(NA, dim = c(20, 16, 9)) # Create empty array
# with correct third dimension
windowfill <- seq(50, 500, 50) # 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 + 51) %% 365)
}
testarray[, 1, 3] <- seq(1, length(testarray[, 1, 3]), 1) # Add
# dummy /code{D} column.
testarray2 <- cumdy(testarray, 3, FALSE) # Apply function on array

[Package ShellChron version 0.4.0 Index]