summaryrefslogtreecommitdiff
path: root/docs/reference/twa.md
diff options
context:
space:
mode:
authorRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-06-22 18:01:11 +0200
committerRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-06-22 18:01:11 +0200
commite0c130005ee7adbac9b832ea8157712419d51b7e (patch)
treef5c188285ee3abd9edda16a6bb96b6142c80afba /docs/reference/twa.md
parentf8fdbc3237d12d5511058d2c0c40f3e99debe682 (diff)
Update static docs
Diffstat (limited to 'docs/reference/twa.md')
-rw-r--r--docs/reference/twa.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/reference/twa.md b/docs/reference/twa.md
new file mode 100644
index 0000000..5c3a4ea
--- /dev/null
+++ b/docs/reference/twa.md
@@ -0,0 +1,49 @@
+# Calculate a time weighted average concentration
+
+The moving average is built only using the values in the past, so the
+earliest possible time for the maximum in the time series returned is
+after one window has passed.
+
+## Usage
+
+``` r
+twa(x, window = 21)
+
+# S3 method for class 'one_box'
+twa(x, window = 21)
+```
+
+## Arguments
+
+- x:
+
+ An object of type
+ [one_box](https://pkgdown.jrwb.de/pfm/reference/one_box.md)
+
+- window:
+
+ The size of the moving window
+
+## See also
+
+[`max_twa`](https://pkgdown.jrwb.de/pfm/reference/max_twa.md)
+
+## Examples
+
+``` r
+pred <- sawtooth(one_box(10),
+ applications = data.frame(time = c(0, 7), amount = c(1, 1)))
+max_twa(pred)
+#> $max
+#> parent
+#> 0.9537545
+#>
+#> $window_start
+#> parent
+#> 0
+#>
+#> $window_end
+#> parent
+#> 21
+#>
+```

Contact - Imprint