This function helps to map between R functions and Stan functions.
lookup(FUN, ReturnType = character())
Ordinarily, a data.frame with rows equal to the number of partial matches and four columns:
StanFunction
Character string for the Stan function's name.
Arguments
Character string indicating the arguments to that Stan function.
ReturnType
Character string indicating the return type of that Stan function.
Page
Integer indicating the page of the Stan reference manual where
that Stan function is defined.
If there are no matching Stan functions, a character string indicating so is returned.
A character string naming a R function or a R function for
which the (near) equivalent Stan function is sought. If no matching
R function is found, FUN
is reinterpreted as a regexp
and matches are sought.
A character string of positive length naming a valid
return type for a Stan function: int
, int[]
, matrix
,
real
, real[,]
, real[]
, row_vector
,
T[]
, vector
, or void
. If "ANY"
is passed,
then the entire data.frame
is returned and can be
inspected with the View
function, for example.
The Stan Development Team Stan Modeling Language User's Guide and Reference Manual. https://mc-stan.org/.
The Stan Development Team CmdStan Interface User's Guide. https://mc-stan.org.
lookup(dnorm) # Stan equivalents for the normal PDF (in log form)
lookup("foo") # fails
lookup("Student") # succeeds even though there is no such R function
lookup("^poisson") # every Stan function that starts with poisson
Run the code above in your browser using DataLab