-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from MindTheGap-ERC/dev
Dev
- Loading branch information
Showing
33 changed files
with
1,204 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: admtools | ||
Title: Estimate and Manipulate Age-Depth Models | ||
Version: 0.1.0.9000 | ||
Version: 0.2.0 | ||
Authors@R: | ||
person("Niklas", "Hohmann", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0003-1559-1838")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
get_data_from_eTimeOpt = function(res, index = 1){ | ||
#' @export | ||
#' @title extract data from eTimeOpt results | ||
#' | ||
#' @param res results generated by eTimeOpt | ||
#' @param index which output should be extracted? See description for details | ||
#' | ||
#' @description | ||
#' Extracts data from eTimeOpt. The type of data extractecd dependes on the `output` setting used for eTimeOpt. If you want ot extract specific data, adjust the output parameter in eTimeOpt to return the correct data (e.g. 2 for r^2 envelope). See eTimeOpt documentation for details on this. Then call this function on the return variable. | ||
#' | ||
#' | ||
#' @seealso [sed_rate_from_matrix()] to use define sedimentation rates based on this functions outputs, [sedrate_to_multiadm()] to estimate age-depth models from the outputs. | ||
#' | ||
#' @returns a list with three entries | ||
#' "sed_rate" : numeric vector, sedimentation rates | ||
#' "height" : numeric vector, heights | ||
#' "results" : matrix with length(height) rows and length(sed_rate) columns. results of eTimeOpt | ||
r = res[[index]] | ||
sedrate = r$sedrates | ||
r = r[, colnames(r) != "sedrates"] | ||
heights = as.numeric(sub(".", "", colnames(r))) | ||
results = data.matrix(r) | ||
|
||
return(list("sed_rate" = sedrate, | ||
"heights" = heights, | ||
"results" = results)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
is_sac = function(x){ | ||
#' @export | ||
#' | ||
#' @title is valid sac objects | ||
#' | ||
#' @description | ||
#' checks if the object is a valid sac object | ||
#' | ||
#' @param x the object to check | ||
#' | ||
#' @returns logical. Is x a valid `sac` object? | ||
|
||
if ( ! inherits(x, "sac")) { return(FALSE) } | ||
|
||
if (! all(names(x) %in% c("t","h","T_unit","L_unit"))) { return(FALSE) } | ||
|
||
if (length(x$t) != length(x$h)) { return(FALSE) } | ||
|
||
if (length(x$t) < 2 ) { return(FALSE) } | ||
|
||
if ( !(is.null(x$T_unit) | is.character(x$T_unit))) { return(FALSE) } | ||
if ( !(is.null(x$L_unit) | is.character(x$L_unit))) { return(FALSE) } | ||
|
||
if (is.unsorted(x$t, strictly = TRUE)) {return(FALSE)} | ||
|
||
return(TRUE) | ||
|
||
} |
Oops, something went wrong.