Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nimbleList

create a nimbleList


Description

create a nimbleList from a nimbleList definition

Usage

nimbleList(..., name = NA, predefined = FALSE,
  where = getNimbleFunctionEnvironment())

Arguments

...

arbitrary set of names and types for the elements of the list or a single R list of type nimbleType.

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 setRefClass for where the reference class definition generated for this nimbleFunction will be stored. This is needed due to R package namespace issues but should never need to be provided by a user.

Details

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.

Author(s)

NIMBLE development team

Examples

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)

nimble

MCMC, Particle Filtering, and Programmable Hierarchical Modeling

v0.11.0
BSD_3_clause + file LICENSE | GPL (>= 2)
Authors
Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut] (Bayesian nonparametrics system), Abel Rodrìguez [aut] (Bayesian nonparametrics system), Duncan Temple Lang [aut] (packaging configuration), Sally Paganin [aut] (reversible jump MCMC), Jagadish Babu [ctb] (code for the compilation system for an early version of NIMBLE), Lauren Ponisio [ctb] (contributions to the cross-validation code), Peter Sujan [ctb] (multivariate t distribution code)
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.