nimble-R-functions | R Documentation |
The functions c
, rep
, seq
, which
, diag
, length
, seq_along
, is.na
, is.nan
, any
, and all
can be used in nimbleFunctions and compiled using compileNimble
.
nimC(...)
nimRep(x, ...)
nimSeq(from, to, by, length.out)
... |
values to be concatenated. |
x |
vector of values to be replicated ( |
from |
starting value of sequence. |
to |
end value of sequence. |
by |
increment of the sequence. |
length.out |
desired length of the sequence. |
For c
, rep
, seq
, these functions are NIMBLE's version of similar R functions, e.g., nimRep
for rep
. In a nimbleFunction
, either the R name (e.g., rep
) or the NIMBLE name (e.g., nimRep
) can be used. If the R name is used, it will be converted to the NIMBLE name. For which
, length
, diag
, seq_along
, is.na
, is.nan
, any
, all
simply use the standard name without "nim"
. These functions largely mimic (see exceptions below) the behavior of their R counterparts, but they can be compiled in a nimbleFunction
using compileNimble
.
nimC
is NIMBLE's version of c
and behaves identically.
nimRep
is NIMBLE's version of rep
. It should behave identically to rep
. There are no NIMBLE versions of rep.int
or rep_len
.
nimSeq
is NIMBLE's version of seq
. It behaves like seq
with support for from
, to
, by
and length.out
arguments. The along.with
argument is not supported. There are no NIMBLE versions of seq.int
, seq_along
or seq_len
, with the exception that seq_along
can take a nimbleFunctionList as an argument to provide the index range of a for-loop (User Manual Ch. 13).
which
behaves like the R version but without support for arr.ind
or useNames
arguments.
diag
behaves like the R version but without support for the nrow
and ncol
arguments.
length
behaves like the R version.
seq_along
behaves like the R version.
is.na
behaves like the R version but does not correctly handle NA
values from R that are type 'logical', so convert these using as.numeric()
before passing from R to NIMBLE.
is.nan
behaves like the R version, but treats NA
of type 'double' as being NaN
and NA
of type 'logical' as not being NaN
.
any
behaves like the R version but takes only one argument and treats NAs as FALSE
.
all
behaves like the R version but takes only one argument and treats NAs as FALSE
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.