diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
index 909fbdff..2bf5cb4e 100644
--- a/.github/workflows/R-CMD-check.yaml
+++ b/.github/workflows/R-CMD-check.yaml
@@ -22,13 +22,14 @@ jobs:
fail-fast: false
matrix:
config:
- - {os: macOS-latest, r: 'release'}
- - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- - {os: windows-latest, r: 'devel'}
+ - {os: macOS-latest, r: 'release'}
+ - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+ - {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'oldrel'}
- {os: windows-latest, r: 'release'}
env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml
index 0d3cb716..06a12d1b 100644
--- a/.github/workflows/pr-commands.yaml
+++ b/.github/workflows/pr-commands.yaml
@@ -21,7 +21,7 @@ jobs:
run: Rscript -e 'roxygen2::roxygenise()'
- name: commit
run: |
- git add man/\* NAMESPACE
+ git add man/\* NAMESPACE DESCRIPTION
git commit -m 'Document'
- uses: r-lib/actions/pr-push@master
with:
diff --git a/DESCRIPTION b/DESCRIPTION
index a4ab970a..6416b313 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,35 +1,19 @@
Package: kwb.qmra
Title: QMRA (quantitative microbial risk assessment)
-Version: 0.3.0
-Authors@R:
- c(person(given = "Michael",
- family = "Rustler",
- role = c("aut", "cre"),
- email = "michael.rustler@kompetenz-wasser.de",
- comment = c(ORCID = "0000-0003-0647-7726")),
- person(given = "Hauke",
- family = "Sonnenberg",
- role = "aut",
- email = "hauke.sonnenberg@kompetenz-wasser.de",
- comment = c(ORCID = "0000-0001-9134-2871")),
- person(given = "Wolfgang",
- family = "Seis",
- role = c("ctb", "rev"),
- email = "wolfgang.seis@kompetenz-wasser.de",
- comment = c(ORCID = "0000-0002-7436-8575")),
- person(given = "Ralf",
- family = "Junghanns",
- role = c("ctb"),
- email = "ralf.junghanns@gmail.com",
- comment = c(ORCID = "")),
- person(given = "Kompetenzzentrum Wasser Berlin gGmbH",
- role = "cph"),
- person(given = "AquaNES",
- role = "fnd"),
- person(given = "DEMOWARE",
- role = "fnd"),
- person(given = "Smart-Control",
- role = "fnd"))
+Version: 0.3.0.9000
+Authors@R: c(
+ person("Michael", "Rustler", , "michael.rustler@kompetenz-wasser.de", role = c("aut", "cre"),
+ comment = c(ORCID = "0000-0003-0647-7726")),
+ person("Hauke", "Sonnenberg", , "hauke.sonnenberg@kompetenz-wasser.de", role = "aut",
+ comment = c(ORCID = "0000-0001-9134-2871")),
+ person("Wolfgang", "Seis", , "wolfgang.seis@kompetenz-wasser.de", role = c("ctb", "rev"),
+ comment = c(ORCID = "0000-0002-7436-8575")),
+ person("Ralf", "Junghanns", , "ralf.junghanns@gmail.com", role = "ctb"),
+ person("Kompetenzzentrum Wasser Berlin gGmbH (KWB)", role = "cph"),
+ person("AquaNES", role = "fnd"),
+ person("DEMOWARE", role = "fnd"),
+ person("Smart-Control", role = "fnd")
+ )
Description: QMRA for water supply systems.
License: MIT + file LICENSE
URL: http://github.com/KWB-R/kwb.qmra/
@@ -66,9 +50,9 @@ Suggests:
VignetteBuilder:
knitr
Remotes:
- github::kwb-r/kwb.utils@v0.7.0,
- github::kwb-r/qmra.db@v0.10.0
+ github::kwb-r/kwb.utils,
+ github::kwb-r/qmra.db
+Config/testthat/edition: 3
Encoding: UTF-8
LazyLoad: yes
RoxygenNote: 7.1.1
-Config/testthat/edition: 3
diff --git a/LICENSE b/LICENSE
index 5c156c7f..7be0cba1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2016 - 2020 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
+Copyright (c) 2016 - 2022 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/LICENSE.md b/LICENSE.md
index 68a6145e..3a13a300 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
# MIT License
-Copyright (c) 2016 - 2020 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
+Copyright (c) 2016 - 20220 Kompetenzzentrum Wasser Berlin gGmbH (KWB)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/NEWS.md b/NEWS.md
index 5572ec84..a3d3f46f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,7 @@
+# [kwb.qmra 0.3.1](https://github.com/KWB-R/kwb.qmra/releases/tag/v0.3.1) 2022-06-08
+
+* Harmonise with kwb.pkgbuild
+
# [kwb.qmra 0.3.0](https://github.com/KWB-R/kwb.qmra/releases/tag/v0.3.0) 2021-02-23
Adaptions for project [Smart-Control](https://www.kompetenz-wasser.de/en/project/smart-control/):
diff --git a/R/random_distribution.R b/R/random_distribution.R
index 9946d0ee..607bb163 100644
--- a/R/random_distribution.R
+++ b/R/random_distribution.R
@@ -89,44 +89,52 @@ get_percentile <- function(percent_within_minmax = 0.9)
}
#' Create random distribution
-#' @param type "uniform" calls runif(), "log10_uniform" calls
-#' 10^runif(number_of_events, log10_min, log10_max), "triangle" calls
-#' EnvStats::rtri(), "lognorm" calls rlnorm(), "norm" calls rnorm() and
-#' "log10_norm" calls 10^rnorm(number_of_events, mean = log10_mean,
+#' @param type "uniform" calls \code{\link[stats]{runif}}, "log10_uniform" calls
+#' 10^\code{\link[stats]{runif}}(number_of_events, log10_min, log10_max), "triangle"
+#' calls \code{\link[EnvStats]{rtri}}, "lognorm" calls \code{\link[stats]{rlnorm}},
+#' "norm" calls \code{\link[stats]{rnorm}} and "log10_norm" calls
+#' 10^\code{\link[stats]{rnorm}}(number_of_events, mean = log10_mean,
#' sdev = log10_sdev), (default: "uniform")
#' @param number_of_repeatings how often should the random distribution with the
#' same parameters be generated (default: 1)
#' @param number_of_events number of events
#' @param value constant value (no random number), gets repeated number_of_events
#' times (if 'type' = 'value')
-#' @param min minimum value (default: 10), only used if 'type' is "runif" or
+#' @param min minimum value (default: 10), only used if 'type' is "uniform" or
#' "triangle"
-#' @param max maximum value (default: 1000), only used if 'type' is "runif" or
+#' @param max maximum value (default: 1000), only used if 'type' is "uniform" or
#' "triangle"
#' @param percent_within_minmax percent of data point within min/max (default:
-#' 0.9 i.e. 90 percent
+#' 0.9 i.e. 90 percent,see also \code{\link{get_percentile}}
#' @param min_zero only used if 'type' is "log10_uniform" or
#' "log10_norm", "norm" or "lognorm" and "min" value equal zero.
#' In this case the zero is replaced by this value (default: 0.01), see also
#' \code{\link{default_min}}
-#' @param log10_min minimum value (default: default_min(min, max,
+#' @param log10_min minimum value (default: \code{\link{default_min}}(min, max,
#' min_zero, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"
-#' @param log10_max maximum value (default: ifelse(max > 0, log10(max),
-#' log10_zero_threshold), only used if 'type' is "log10_uniform" or "log10_norm"
+#' @param log10_max maximum value (default: \code{\link{default_max}}(max,
+#' min_zero * 10, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"
#' @param log10_mean mean value (default: (log10_min + log10_max)/2), only used
#' if 'type' is "log10_norm"
#' @param log10_sdev standard deviation (default: abs((log10_max- log10_mean) /
-#' get_percentile(0.95)), only used if 'type' is "log10_norm"
-#' @param mean mean value (default: (default_min(min, max, min_zero) /
-#' default_max(max, 10*min_zero)) / 2), only used if 'type' is "norm"
-#' @param sdev standard deviation (default: abs((default_max(max, 10*min_zero) -
-#' mean) / get_percentile(0.95))), only used if 'type' is "norm"
-#' @param meanlog log mean value (default: mean(log((min + max) / 2))), only
+#' \code{\link{get_percentile}}(percent_within_minmax))), only used if 'type' is
+#' "log10_norm"
+#' @param mean mean value (default: (\code{\link{default_min}}(min, max, min_zero) /
+#' \code{\link{default_max}}(max, 10*min_zero)) / 2), only used if 'type' is "norm"
+#' @param sdev standard deviation (default: abs((log10_max - log10_mean) /
+#' \code{\link{get_percentile}}(percent_within_minmax))), only used if 'type' is
+#' "norm"
+#' @param meanlog log mean value (default:
+#' mean(log( \code{\link{default_min}}(min, max, min_zero) +
+#' \code{\link{default_max}}(max, 10 * min_zero)) / 2)), only
#' used if 'type' is "lognorm"
-#' @param sdlog standard deviation (default: abs(sd(c(default_min(min, max,
-#' min_zero, f = log)))) ), only used if 'type' is "lognorm"
-#' @param mode (default: default_min(min, max, min_zero) +
-#' default_max(max, 10 * min_zero) / 2), only used if 'type' is "triangle"
+#' @param sdlog standard deviation (default: abs(sd(c(
+#' \code{\link{default_min}}(min, max, min_zero, f = log),
+#' \code{\link{default_max}}(max, 10 * min_zero, f = log)))),
+#' only used if 'type' is "lognorm"
+#' @param mode (default: \code{\link{default_min}}(min, max, min_zero) +
+#' \code{\link{default_max}}(max, 10 * min_zero) / 2), only used if 'type' is
+#' "triangle"
#' @param debug print debug information (default: TRUE)
#' @return list with parameters of user defined random distribution and
#' corresponding values
@@ -134,7 +142,7 @@ get_percentile <- function(percent_within_minmax = 0.9)
#' @importFrom stats sd qnorm runif rnorm rlnorm
#' @importFrom dplyr mutate
#' @importFrom rlang .data
-#' @seealso for random triangle see \code{\link{rtri}}, for default
+#' @seealso for random triangle see \code{\link[EnvStats]{rtri}}, for default
#' min/max see \code{\link{default_min}}, \code{\link{default_max}} and
#' \code{\link{get_percentile}}
#'
diff --git a/README.md b/README.md
index 29cabebe..bdb9a2fd 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@
[](https://www.tidyverse.org/lifecycle/#maturing)
[](https://zenodo.org/badge/latestdoi/68301647)
[](https://mybinder.org/v2/gh/kwb-r/kwb.qmra/master?urlpath=rstudio)
+[]()
+[](https://kwb-r.r-universe.dev/)
# kwb.qmra
@@ -13,6 +15,23 @@ Launch repository (from master) in cloud RStudio session:
[](https://mybinder.org/v2/gh/kwb-r/kwb.qmra/master?urlpath=rstudio)
+## Installation
+
+For installing the latest release of this R package run the following code below:
+
+```r
+# Enable repository from kwb-r
+options(repos = c(
+ kwbr = 'https://kwb-r.r-universe.dev',
+ CRAN = 'https://cloud.r-project.org'))
+
+# Download and install kwb.qmra in R
+install.packages('kwb.qmra')
+
+# Browse the kwb.qmra manual pages
+help(package = 'kwb.qmra')
+```
+
## Documentation
Development version: [https://kwb-r.github.io/kwb.qmra/dev](https://kwb-r.github.io/kwb.qmra/dev)
diff --git a/_pkgdown.yaml b/_pkgdown.yaml
index c03e17bc..01e4c875 100644
--- a/_pkgdown.yaml
+++ b/_pkgdown.yaml
@@ -2,31 +2,39 @@ authors:
Michael Rustler:
href: https://mrustl.de
Hauke Sonnenberg:
- href: https://github.com/hsonne
+ href: https://www.kompetenz-wasser.de/en/ueber-uns/team/hauke-sonnenberg
Wolfgang Seis:
- href: https://www.researchgate.net/profile/Wolfgang_Seis
- Kompetenzzentrum Wasser Berlin gGmbH:
- href: https://www.kompetenz-wasser.de
- html:
- AquaNES:
- href: https://www.kompetenz-wasser.de/en/project/aquanes/
- html:
+ href: https://www.kompetenz-wasser.de/en/ueber-uns/team/wolfgang-seis
+ AquaNES:
+ href: https://www.kompetenz-wasser.de/en/forschung/projekte/aquanes
+ html:
DEMOWARE:
- href: https://www.kompetenz-wasser.de/en/project/demoware/
- html:
+ href: https://www.kompetenz-wasser.de/en/forschung/projekte/demoware/
+ html:
Smart-Control:
- href: https://www.kompetenz-wasser.de/en/project/smart-control/
- html:
+ href: https://www.kompetenz-wasser.de/en/forschung/projekte/smart-control/
+ html:
+ Kompetenzzentrum Wasser Berlin gGmbH (KWB):
+ href: https://www.kompetenz-wasser.de
+ html:
template:
- params:
- bootswatch: cerulean
- docsearch:
- api_key: ba545525664b60ab9e580ae0f7f4ac02
- index_name: kwb_qmra
+ bootstrap: 5
+ bootswatch: cerulean
+ bslib:
+ bg: '#ffffff'
+ fg: '#000000'
+ primary: '#007aff'
+ border-radius: 0.5rem
+ btn-border-radius: 0.25rem
+development:
+ mode: auto
+
navbar:
title: ~
- type: default
left:
- text: Background
href: articles/general.html
@@ -89,6 +97,14 @@ reference:
Functions for plotting QMRA results
contents:
- starts_with("plot_")
+
+ - title: Datasets
+ desc: >
+ Datasets within R package
+ contents:
+ - config_default_json
+ - config_dummy_json
+ - risk_dummy_json
- title: Export data
desc: >
@@ -100,16 +116,22 @@ reference:
- title: Helper functions
desc: >
Helper functions for performing QMRA
- contents:
+ contents:
+ - backcalc_infectionRisk_perDay
+ - calc_health_risk
+ - calc_infection_risk
- config_write_dummy
- create_random_distribution
- - start_with("default")
+ - default_max
+ - default_min
- generate_random_values
+ - get_percentile
- distribution_repeater
- dr.betapoisson
- dr.db_download
- dr.db_model
- dr.expo
- poisson_dose
+ - run_app
- who_getTreatment
diff --git a/index.md b/index.md
index 6c740ee7..5214b3ab 100644
--- a/index.md
+++ b/index.md
@@ -4,14 +4,25 @@
[](https://www.tidyverse.org/lifecycle/#maturing)
[](https://zenodo.org/badge/latestdoi/68301647)
[](https://mybinder.org/v2/gh/kwb-r/kwb.qmra/master?urlpath=rstudio)
-
+[]()
+[](https://kwb-r.r-universe.dev/)
An R package for QMRA (quantitative microbial risk assessment) of water supply systems
## Installation
+For installing the latest release of this R package run the following code below:
+
```r
-#install.packages("remotes", repos = "https://cloud.r-project.org")
-remotes::install_github("KWB-R/kwb.qmra")
+# Enable repository from kwb-r
+options(repos = c(
+ kwbr = 'https://kwb-r.r-universe.dev',
+ CRAN = 'https://cloud.r-project.org'))
+
+# Download and install kwb.qmra in R
+install.packages('kwb.qmra')
+
+# Browse the kwb.qmra manual pages
+help(package = 'kwb.qmra')
```
\ No newline at end of file
diff --git a/man/create_random_distribution.Rd b/man/create_random_distribution.Rd
index 82251d4d..b80761d8 100644
--- a/man/create_random_distribution.Rd
+++ b/man/create_random_distribution.Rd
@@ -29,10 +29,11 @@ create_random_distribution(
)
}
\arguments{
-\item{type}{"uniform" calls runif(), "log10_uniform" calls
-10^runif(number_of_events, log10_min, log10_max), "triangle" calls
-EnvStats::rtri(), "lognorm" calls rlnorm(), "norm" calls rnorm() and
-"log10_norm" calls 10^rnorm(number_of_events, mean = log10_mean,
+\item{type}{"uniform" calls \code{\link[stats]{runif}}, "log10_uniform" calls
+10^\code{\link[stats]{runif}}(number_of_events, log10_min, log10_max), "triangle"
+calls \code{\link[EnvStats]{rtri}}, "lognorm" calls \code{\link[stats]{rlnorm}},
+"norm" calls \code{\link[stats]{rnorm}} and "log10_norm" calls
+10^\code{\link[stats]{rnorm}}(number_of_events, mean = log10_mean,
sdev = log10_sdev), (default: "uniform")}
\item{number_of_repeatings}{how often should the random distribution with the
@@ -43,46 +44,53 @@ same parameters be generated (default: 1)}
\item{value}{constant value (no random number), gets repeated number_of_events
times (if 'type' = 'value')}
-\item{min}{minimum value (default: 10), only used if 'type' is "runif" or
+\item{min}{minimum value (default: 10), only used if 'type' is "uniform" or
"triangle"}
-\item{max}{maximum value (default: 1000), only used if 'type' is "runif" or
+\item{max}{maximum value (default: 1000), only used if 'type' is "uniform" or
"triangle"}
\item{percent_within_minmax}{percent of data point within min/max (default:
-0.9 i.e. 90 percent}
+0.9 i.e. 90 percent,see also \code{\link{get_percentile}}}
\item{min_zero}{only used if 'type' is "log10_uniform" or
"log10_norm", "norm" or "lognorm" and "min" value equal zero.
In this case the zero is replaced by this value (default: 0.01), see also
\code{\link{default_min}}}
-\item{log10_min}{minimum value (default: default_min(min, max,
+\item{log10_min}{minimum value (default: \code{\link{default_min}}(min, max,
min_zero, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"}
-\item{log10_max}{maximum value (default: ifelse(max > 0, log10(max),
-log10_zero_threshold), only used if 'type' is "log10_uniform" or "log10_norm"}
+\item{log10_max}{maximum value (default: \code{\link{default_max}}(max,
+min_zero * 10, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"}
\item{log10_mean}{mean value (default: (log10_min + log10_max)/2), only used
if 'type' is "log10_norm"}
\item{log10_sdev}{standard deviation (default: abs((log10_max- log10_mean) /
-get_percentile(0.95)), only used if 'type' is "log10_norm"}
+\code{\link{get_percentile}}(percent_within_minmax))), only used if 'type' is
+"log10_norm"}
-\item{mean}{mean value (default: (default_min(min, max, min_zero) /
-default_max(max, 10*min_zero)) / 2), only used if 'type' is "norm"}
+\item{mean}{mean value (default: (\code{\link{default_min}}(min, max, min_zero) /
+\code{\link{default_max}}(max, 10*min_zero)) / 2), only used if 'type' is "norm"}
-\item{sdev}{standard deviation (default: abs((default_max(max, 10*min_zero) -
-mean) / get_percentile(0.95))), only used if 'type' is "norm"}
+\item{sdev}{standard deviation (default: abs((log10_max - log10_mean) /
+\code{\link{get_percentile}}(percent_within_minmax))), only used if 'type' is
+"norm"}
-\item{meanlog}{log mean value (default: mean(log((min + max) / 2))), only
+\item{meanlog}{log mean value (default:
+mean(log( \code{\link{default_min}}(min, max, min_zero) +
+\code{\link{default_max}}(max, 10 * min_zero)) / 2)), only
used if 'type' is "lognorm"}
-\item{sdlog}{standard deviation (default: abs(sd(c(default_min(min, max,
-min_zero, f = log)))) ), only used if 'type' is "lognorm"}
+\item{sdlog}{standard deviation (default: abs(sd(c(
+\code{\link{default_min}}(min, max, min_zero, f = log),
+\code{\link{default_max}}(max, 10 * min_zero, f = log)))),
+only used if 'type' is "lognorm"}
-\item{mode}{(default: default_min(min, max, min_zero) +
-default_max(max, 10 * min_zero) / 2), only used if 'type' is "triangle"}
+\item{mode}{(default: \code{\link{default_min}}(min, max, min_zero) +
+\code{\link{default_max}}(max, 10 * min_zero) / 2), only used if 'type' is
+"triangle"}
\item{debug}{print debug information (default: TRUE)}
}
@@ -94,7 +102,7 @@ corresponding values
Create random distribution
}
\seealso{
-for random triangle see \code{\link{rtri}}, for default
+for random triangle see \code{\link[EnvStats]{rtri}}, for default
min/max see \code{\link{default_min}}, \code{\link{default_max}} and
\code{\link{get_percentile}}
}