View source: R/nimbleFunction_Rexecution.R
nimNumeric | R Documentation |
In a nimbleFunction
, numeric
, integer
and logical
are identical to nimNumeric
, nimInteger
and nimLogical
, respectively.
nimNumeric(
length = 0,
value = 0,
init = TRUE,
fillZeros = TRUE,
recycle = TRUE
)
nimInteger(
length = 0,
value = 0,
init = TRUE,
fillZeros = TRUE,
recycle = TRUE
)
nimLogical(
length = 0,
value = 0,
init = TRUE,
fillZeros = TRUE,
recycle = TRUE
)
length |
the length of the vector (default = 0) |
value |
value(s) for initializing the vector (default = 0). This may be a vector, matrix or array but will be used as a vector. |
init |
logical, whether to initialize elements of the vector (default = TRUE) |
fillZeros |
logical, whether to initialize any elements not filled by (possibly recycled) |
recycle |
logical, whether |
These functions are similar to R's numeric
, integer
, logical
functions, but they can be used in a nimbleFunction and then compiled using compileNimble
. Largely for compilation purposes, finer control is provided over initialization behavior. If init = FALSE
, no initialization will be done, and value
, fillZeros
and recycle
will be ignored. If init=TRUE
and recycle=TRUE
, then fillZeros
will be ignored, and value
will be repeated (according to R's recycling rule) as much as necessary to fill a vector of length length
. If init=TRUE
and recycle=FALSE
, then if fillZeros=TRUE
, values of 0 (or FALSE for nimLogical
) will be filled in after value
up to length length
. Compiled code will be more efficient if unnecessary initialization is not done, but this may or may not be noticeable depending on the situation.
When used in a nimbleFunction
(in run
or other member function), numeric
, integer
and logical
are immediately converted to nimNumeric
, nimInteger
and nimLogical
, respectively.
Daniel Turek, Christopher Paciorek, Perry de Valpine
nimMatrix
, nimArray
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.