ts_ | R Documentation |
ts_
turns an existing function into a function that can deal with
ts-boxable time series objects.
load_suggested(pkg)
ts_(fun, class = "ts", vectorize = FALSE, reclass = TRUE)
ts_apply(x, fun, ...)
pkg |
external package, to be suggested (automatically added by |
fun |
function, to be made available to all time series classes |
class |
class that the function uses as its first argument |
vectorize |
should the function be vectorized? (not yet implemented) |
reclass |
logical, should the new function return the same same ts-boxable output as imputed? |
x |
ts-boxable time series, an object of class |
... |
arguments passed to subfunction |
The ts_
function is a constructor function for tsbox time series functions.
It can be used to wrap any function that works with time series. The default
is set to R base "ts"
class. ts_
deals with the conversion stuff,
'vectorizes' the function so that it can be used with multiple time series.
A function that accepts ts-boxable time series as an input.
ts_examples, for a few useful examples of functions generated by
ts_
.
Vignette on how to make arbitrary functions ts-boxable.
ts_(rowSums)(ts_c(mdeaths, fdeaths))
ts_plot(mean = ts_(rowMeans)(ts_c(mdeaths, fdeaths)), mdeaths, fdeaths)
ts_(function(x) predict(prcomp(x)))(ts_c(mdeaths, fdeaths))
ts_(function(x) predict(prcomp(x, scale = TRUE)))(ts_c(mdeaths, fdeaths))
ts_(dygraphs::dygraph, class = "xts")
# attach series to serach path
ts_attach <- ts_(attach, class = "tslist", reclass = FALSE)
ts_attach(EuStockMarkets)
ts_plot(DAX, SMI)
detach()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.