TS function definition
ts_function.RdTS function definition
Usage
ts_function(f, ..., result = ts_void())Details
Defining functions is the core of writing Rserve apps. Functions are referred to as object capabilities (ocaps), as they are 'objects' that allow Javascript to access capabilities of R with a restricted interface. Only arguments can be adjusted.
TS functions can be defined using existing (named) or anonymous functions. Anonymous functions are useful in that the arguments to the functions can explicitly be defined with their types as formal arguments:
Examples
f <- ts_function(function(x = ts_integer(1), y = ts_character(1)) {
x + nchar(y)
}, result = ts_integer(1))
f$call(1, "hello")
#> [1] 6