From 6ea0b67993ba981e1e06d2d98286e2f451bd79fc Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Wed, 29 Jan 2025 09:29:42 +1300 Subject: [PATCH] add file --- vignettes/.gitignore | 2 +- vignettes/faithful-app.R | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 vignettes/faithful-app.R diff --git a/vignettes/.gitignore b/vignettes/.gitignore index c911dc7..77d281f 100644 --- a/vignettes/.gitignore +++ b/vignettes/.gitignore @@ -1,3 +1,3 @@ *.html -*.R +#*.R faithful-demo diff --git a/vignettes/faithful-app.R b/vignettes/faithful-app.R new file mode 100644 index 0000000..fba9d4f --- /dev/null +++ b/vignettes/faithful-app.R @@ -0,0 +1,16 @@ +library(ts) + +get_hist <- ts_function( + function(bins = ts_integer(1)) { + h <- hist(faithful$waiting, breaks = bins, plot = FALSE) + data.frame(x = h$mids, y = h$density) + }, + result = ts_dataframe(eruptions = ts_numeric(), waiting = ts_numeric()) +) +get_smoother <- ts_function( + function(bandwidth = ts_numeric(1)) { + d <- density(faithful$waiting, bw = bandwidth) + data.frame(x = d$x, y = d$y) + }, + result = ts_dataframe(x = ts_numeric(), y = ts_numeric()) +)