ts/vignettes/faithful-app.R
2025-01-29 09:29:42 +13:00

17 lines
505 B
R

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())
)