Learn R Programming

sits (version 1.12.0)

.sits_function_factory: Create a closure for calling functions with and without data

Description

This internal function implements the factory method pattern for the sits package Its role is to create a generic interface to closures in R so that the functions in the sits package can be called in two different ways: 1. They can be called directly, passing input data and parameters. 2. They can be called as second-order values (parameters of another function). In the second case, the call will pass no data values and only pass the parameters for execution

The factory pattern is used in many situations in the sits package, to allow different alternatives for filtering, pattern creation, training, and cross-validation

Usage

.sits_factory_function(data.tb, fun)

Arguments

data.tb

Tibble with time series data and metadata.

fun

The function that performs some calculation on the input data.