diff options
author | Ranke Johannes <johannes.ranke@agroscope.admin.ch> | 2025-01-29 15:44:35 +0100 |
---|---|---|
committer | Ranke Johannes <johannes.ranke@agroscope.admin.ch> | 2025-01-29 15:44:35 +0100 |
commit | 2bf16e09ca3c451cb26eee108dc95764576d084d (patch) | |
tree | 8663f6c07533c724ba1a391865c72652654f43d1 | |
parent | e6dfdecf78c448f3a0947c3e70806697c7586bc3 (diff) |
Fix plot.one_box() for the case that a twa is shown
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | R/twa.R | 7 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | pfm.Rproj | 1 |
4 files changed, 11 insertions, 5 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index a51e404..3e64e31 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,6 +32,6 @@ License: GPL LazyLoad: true LazyData: true Encoding: UTF-8 -URL: https://pkgdown.jrwb.de/pfm, https://github.com/jranke/pfm +URL: https://pkgdown.jrwb.de/pfm, https://github.com/jranke/pfm, http://jranke.github.io/pfm/ Roxygen: list(markdown = TRUE, r6 = TRUE) RoxygenNote: 7.3.2.9000 @@ -131,6 +131,7 @@ one_box.mkinfit <- function(x, ini = "model", ..., t_end = 100, res = 0.01) { #' fit_2 <- mkinfit(m_2, FOCUS_2006_D, quiet = TRUE) #' pred_2 <- one_box(fit_2, ini = 1) #' pred_2_saw <- sawtooth(pred_2, 2, 7) +#' plot(pred_2_saw) #' plot(pred_2_saw, max_twa = 21, max_twa_var = "m1") plot.one_box <- function(x, xlim = range(time(x)), ylim = c(0, max(x)), @@ -148,7 +149,9 @@ plot.one_box <- function(x, x_twa$window_end[max_twa_var], value, col = "grey") text(x_twa$window_end[max_twa_var], value, paste("Maximum:", signif(value, 3)), pos = 4) # Plot a second time to cover the grey rectangle - matlines(time(x), as.matrix(x), lty = 1:length(obs_vars), col = 1:length(obs_vars)) + plot.ts(x, plot.type = "single", xlab = xlab, ylab = ylab, + lty = 1:length(obs_vars), col = 1:length(obs_vars), + las = 1, xlim = xlim, ylim = ylim) } } @@ -229,7 +232,7 @@ twa.one_box <- function(x, window = 21) resolution = 1/frequency(x) n_filter = window/resolution - result = filter(x, rep(1/n_filter, n_filter), method = "convolution", sides = 1) + result = stats::filter(x, rep(1/n_filter, n_filter), method = "convolution", sides = 1) class(result) = c("one_box", "ts") dimnames(result) <- dimnames(x) return(result) @@ -6,7 +6,8 @@ [![codecov](https://codecov.io/github/jranke/pfm/branch/main/graphs/badge.svg)](https://codecov.io/github/jranke/pfm) The R package **pfm** provides some utilities for fate modelling, including -dealing with FOCUS pesticide fate modelling tools, (currently only TOXSWA cwa +simple PEC calculation routines and some routines for +dealing with FOCUS pesticide fate modelling tools (currently only TOXSWA cwa and out files), made available under the GNU public license. ## Installation @@ -15,7 +16,8 @@ The easiest way to install the package is probably to use the [r-universe repo](https://jranke.r-universe.dev/pfm): ```r -install.packages("pfm", repos = c("https://jranke.r-universe.dev", "https://cran.r-project.org")) +install.packages("pfm", + repos = c("https://jranke.r-universe.dev", "https://cran.r-project.org")) ``` The packages at R-universe are provided with a slight delay. Alternatively, you @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 3fe3eae4-f182-4b74-88d9-017fe88380f0 RestoreWorkspace: Default SaveWorkspace: Default |