diff --git a/.Rbuildignore b/.Rbuildignore index 1e46aa4..5767c20 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,5 @@ ^_pkgdown\.yml$ ^docs$ ^pkgdown$ + +^CONTRIBUTING.md$ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..84199ff --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,36 @@ +# contributing to this repository + +Welcome, and thank you for contributing to this codebase! This document specifies contribution guidelines. + +## Important links + +- [Bug reporting](#reporting-bugs) +- [Request features or enhancements](#request-features-or-enhancements) +- [Improving documentation](#improving-documentation) +- [Contributing code and features](#contributing-code-and-features) + +## Contribution guidelines + +### Reporting bugs {#reporting-bugs} + +Suspect or found a bug? To report it, use the GitHub issues [here](https://github.com/MindTheGap-ERC/admtools/issues), and tag your issue with the "bug" label. Please describe the bug in as much detail as you can, including (1) a description of the unexpected behavior you observed (2) what behavior you expected and (3) (if possible) a minimum running example. The more detailed your bug report is, the easier it is for us to fix, and the faster we will be able to fix it. + +### Request features or enhancements + +Do you think the codebase is lacking, could use a cool new feature, or should better integrate with existing codebases or packages? Then submit your feature/enhancement request in the [Github issues](https://github.com/MindTheGap-ERC/admtools/issues) using the "enhancement" label. Please describe in detail what the new feature should do, and how it should integrate with the existing codebase or other packages. We will review each enhancement request and decide on a case-by-case basis if we will implement it. Our decision is guided both by the usefulness of the request and available development time. + +### Improving documentation + +Do you think the documentation is lacking? We're always happy to improve! If you want to improve documentation, fork the repository, make your changes, and submit a pull request with the "documentation" label. We will include your improvements into the code base after a review. + +### Contributing code and features + +Would you like to contribute a new feature to the code base, or improve existing code? Then fork the repository, add your features, and submit a pull request using the "enhancement" label. We will decide on a case-by-case basis if the pull request is accepted or not. This will be discussed with all active authors and contributers to the code base. Criteria for inclusion of new code are code quality, clarity and utility of the features, and whether the new feature enhances the original idea of the code base. If you are unsure if your feature would fit into the codebase, please use GitHub issues to discuss your idea (using the "enhancement" label) so we can give you feedback. + +While this is not a criterion for code inclusion, we strongly encourage that each new feature includes tests that ensure that the feature works as intended and integrates with the existing codebase seamlessly. + +When you contribute new functionality please add it to the list of available functionality under `vignettes/admtools_doc.Rmd` + +## Authors and contributors + +For a list of authors and contributors please see the README file. diff --git a/NAMESPACE b/NAMESPACE index 00e6e61..413dae4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,6 +30,10 @@ S3method(get_total_thickness,adm) S3method(get_total_thickness,multiadm) S3method(is_destructive,adm) S3method(is_destructive,multiadm) +S3method(max_height,adm) +S3method(max_time,adm) +S3method(min_height,adm) +S3method(min_time,adm) S3method(plot,adm) S3method(plot,multiadm) S3method(plot,sac) @@ -79,10 +83,14 @@ export(is_adm) export(is_destructive) export(is_sac) export(make_legend) +export(max_height) +export(max_time) export(mean_adm) export(median_adm) export(merge_adm_to_multiadm) export(merge_multiadm) +export(min_height) +export(min_time) export(plot_condensation) export(plot_erosive_intervals) export(plot_sed_rate_l) diff --git a/R/get_total_duration.R b/R/get_total_duration.R index 316b680..0aecce0 100644 --- a/R/get_total_duration.R +++ b/R/get_total_duration.R @@ -8,5 +8,7 @@ get_total_duration = function(x){ #' #' @returns numeric vector, total duration covered by the age-depth models #' + #' @seealso [min_time()] and [max_time()] to extract the first/last tie point in time + #' UseMethod("get_total_duration") } diff --git a/R/get_total_thickness.R b/R/get_total_thickness.R index ed80372..279426e 100644 --- a/R/get_total_thickness.R +++ b/R/get_total_thickness.R @@ -10,5 +10,7 @@ get_total_thickness = function(x){ #' #' @returns numeric vector containing total sediment thickness accumulated #' + #' @seealso [max_height()] and [min_height()] to extract the highest/lowest stratigraphic point + #' UseMethod("get_total_thickness") } \ No newline at end of file diff --git a/R/max_heigth.R b/R/max_heigth.R new file mode 100644 index 0000000..51150cc --- /dev/null +++ b/R/max_heigth.R @@ -0,0 +1,19 @@ +max_height = function(x){ + #' @export + #' + #' @title get highest stratigraphic position in an adm + #' + #' @param x an age-depth model + #' + #' @returns a scalar + #' + #' @seealso [min_height()], [get_total_thickness()] + #' + UseMethod("max_height") +} + +max_height.adm = function(x){ + #' @export + + return(max(x$h)) +} \ No newline at end of file diff --git a/R/max_time.R b/R/max_time.R new file mode 100644 index 0000000..8f2cae6 --- /dev/null +++ b/R/max_time.R @@ -0,0 +1,19 @@ +max_time = function(x){ + #' @export + #' + #' @title extract earliest time from adm + #' + #' @param x age-depth model + #' + #' @returns a scalar, timing of earliest tie point in the adm + #' + #' @seealso [min_time()], [get_total_duration()] + #' + UseMethod("max_time") +} + +max_time.adm = function(x){ + #' @export + #' + return(max(x$t)) +} \ No newline at end of file diff --git a/R/min_height.R b/R/min_height.R new file mode 100644 index 0000000..75c8446 --- /dev/null +++ b/R/min_height.R @@ -0,0 +1,20 @@ +min_height = function(x){ + + #' @export + #' + #' @title get lowest stratigraphic position in an adm + #' + #' @param x an age-depth model + #' + #' @seealso [get_total_thickness()], [max_height()] + #' + UseMethod("min_height") + +} + +min_height.adm = function(x){ + + #' @export + + return(min(x$h)) +} \ No newline at end of file diff --git a/R/min_time.R b/R/min_time.R new file mode 100644 index 0000000..3d31ee2 --- /dev/null +++ b/R/min_time.R @@ -0,0 +1,19 @@ +min_time = function(x){ + #' @export + #' + #' @title extract last time from adm + #' + #' @param x age-depth model + #' + #' @returns a scalar, timing of last tie point in the adm + #' + #' @seealso [max_time()], [get_total_duration()] + #' + UseMethod("min_time") +} + +min_time.adm = function(x){ + #' @export + #' + return(min(x$t)) +} \ No newline at end of file diff --git a/README.md b/README.md index 1ed2431..098b009 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ GPL-3.0, see LICENSE file for license text. Copyright 2023 Netherlands eScience Center and Utrecht University +## Contribution + +For contribution guidelines see the CONTRIBUTING.md file + ## Citation To cite the package, use diff --git a/man/get_total_duration.Rd b/man/get_total_duration.Rd index aa48a62..049c9f9 100644 --- a/man/get_total_duration.Rd +++ b/man/get_total_duration.Rd @@ -15,3 +15,6 @@ numeric vector, total duration covered by the age-depth models \description{ Total duration covered } +\seealso{ +\code{\link[=min_time]{min_time()}} and \code{\link[=max_time]{max_time()}} to extract the first/last tie point in time +} diff --git a/man/get_total_thickness.Rd b/man/get_total_thickness.Rd index 19fdc43..fb61ee8 100644 --- a/man/get_total_thickness.Rd +++ b/man/get_total_thickness.Rd @@ -15,3 +15,6 @@ numeric vector containing total sediment thickness accumulated \description{ get thickness } +\seealso{ +\code{\link[=max_height]{max_height()}} and \code{\link[=min_height]{min_height()}} to extract the highest/lowest stratigraphic point +} diff --git a/man/max_height.Rd b/man/max_height.Rd new file mode 100644 index 0000000..3ec17dc --- /dev/null +++ b/man/max_height.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/max_heigth.R +\name{max_height} +\alias{max_height} +\title{get highest stratigraphic position in an adm} +\usage{ +max_height(x) +} +\arguments{ +\item{x}{an age-depth model} +} +\value{ +a scalar +} +\description{ +get highest stratigraphic position in an adm +} +\seealso{ +\code{\link[=min_height]{min_height()}}, \code{\link[=get_total_thickness]{get_total_thickness()}} +} diff --git a/man/max_time.Rd b/man/max_time.Rd new file mode 100644 index 0000000..4eaa3fc --- /dev/null +++ b/man/max_time.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/max_time.R +\name{max_time} +\alias{max_time} +\title{extract earliest time from adm} +\usage{ +max_time(x) +} +\arguments{ +\item{x}{age-depth model} +} +\value{ +a scalar, timing of earliest tie point in the adm +} +\description{ +extract earliest time from adm +} +\seealso{ +\code{\link[=min_time]{min_time()}}, \code{\link[=get_total_duration]{get_total_duration()}} +} diff --git a/man/min_height.Rd b/man/min_height.Rd new file mode 100644 index 0000000..c8ffd8a --- /dev/null +++ b/man/min_height.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/min_height.R +\name{min_height} +\alias{min_height} +\title{get lowest stratigraphic position in an adm} +\usage{ +min_height(x) +} +\arguments{ +\item{x}{an age-depth model} +} +\description{ +get lowest stratigraphic position in an adm +} +\seealso{ +\code{\link[=get_total_thickness]{get_total_thickness()}}, \code{\link[=max_height]{max_height()}} +} diff --git a/man/min_time.Rd b/man/min_time.Rd new file mode 100644 index 0000000..f3319fe --- /dev/null +++ b/man/min_time.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/min_time.R +\name{min_time} +\alias{min_time} +\title{extract last time from adm} +\usage{ +min_time(x) +} +\arguments{ +\item{x}{age-depth model} +} +\value{ +a scalar, timing of last tie point in the adm +} +\description{ +extract last time from adm +} +\seealso{ +\code{\link[=max_time]{max_time()}}, \code{\link[=get_total_duration]{get_total_duration()}} +} diff --git a/vignettes/admtools_doc.Rmd b/vignettes/admtools_doc.Rmd index 5af1b4b..da8d417 100644 --- a/vignettes/admtools_doc.Rmd +++ b/vignettes/admtools_doc.Rmd @@ -89,6 +89,10 @@ The following functions extract information from `adm` objects: - `is_destructive` - `sed_rate_l` and `sed_rate_l_fun` to extract sedimentation rate in height domain - `sed_rate_t` and `sed_rate_t_fun` to extract sedimentation rate in time domain +- `max_height.adm` extracts highest stratigraphic point in adm +- `min_height.adm` extracts lowest stratigaphic point in adm +- `min_time.adm` extracts timing of first tie point in adm +_ `max_time.adm` extracts timing of last tie point in adm #### Transformation into other S3 classes