Learn R Programming

nimble (version 1.2.1)

setupOutputs: Explicitly declare objects created in setup code to be preserved and compiled as member data

Description

Normally a nimbleFunction determines what objects from setup code need to be preserved for run code or other member functions. setupOutputs allows explicit declaration for cases when an object created in setup code is not used in member functions.

Arguments

...

An arbitrary set of names

Details

Normally any object created in setup whose name appears in run or another member function is included in the saved results of setup code. When the nimbleFunction is compiled, such objects will become member data of the resulting C++ class. If it is desired to force an object to become member data even if it does not appear in a member function, declare it using setupOutputs. E.g., setupOutputs(a, b) declares that a and b should be preserved.

The setupOutputs line will be removed from the setup code. It is really a marker during nimbleFunction creation of what should be preserved.