R: Create a closure for calling functions with and without data

.sits_function_factory {sits} | R Documentation

## Create a closure for calling functions with and without data

### Description

This internal function implements the factory method pattern. Its creates a generic interface to closures in R so that the functions in the sits package can be called in two different ways: 1. Called directly, passing input data and parameters. 2. 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, fun)

### Arguments

`data` | Tibble with time series data and metadata.
`fun` | The function that performs calculation on the input data.

### Author(s)

Rolf Simoes, rolf.simoes@inpe.br

Gilberto Camara, gilberto.camara@inpe.br

[Package sits version 0.13.0 Index]