View source: R/nimbleList_core.R
nimbleList | R Documentation |
create a nimbleList from a nimbleList definition
nimbleList(
...,
name = as.character(NA),
predefined = FALSE,
where = getNimbleFunctionEnvironment()
)
... |
arbitrary set of names and types for the elements of the list or a single R list of type |
name |
optional character providing a name used internally, for example in generated C++ code. Usually this is left blank and NIMBLE provides a name. |
predefined |
logical for internal use only. |
where |
optional argument passed to |
This function creates a definition for a nimbleList. The types
argument defines the names, types, and dimensions of the elements of the nimbleList. Elements of nimbleLists can be either basic types (e.g., integer
, double
) or other nimbleList definitions.
The types
argument can be either a series of expressions of the form name = type(dim)
, or a list of nimbleType
objects.
nimbleList
returns a definition, which can be used to create instances of this type of nimbleList via the new()
member function.
Definitions can be created in R's general environment or in nimbleFunction setup code. Instances can be created using the new()
function in R's global environment, in nimbleFunction setup code, or in nimbleFunction run code.
Instances of nimbleList
definitions can be used as arguments to run code of nimbleFunctions, and as the return type of nimbleFunctions.
NIMBLE development team
exampleNimListDef <- nimbleList(x = integer(0), Y = double(2))
nimbleListTypes <- list(nimbleType(name = 'x', type = 'integer', dim = 0),
nimbleType(name = 'Y', type = 'double', dim = 2))
## this nimbleList definition is identical to the one created above
exampleNimListDef <- nimbleList(nimbleListTypes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.