Using the package R::extraDistr I noticed that many R functions of this package just call some cpp functions that do exactly the same work. For example, writing the command dtnorm, that gives us the density function of the truncated Normal distribution, we obtain in console
function (x, mean = 0, sd = 1, a = -Inf, b = Inf, log = FALSE)
{
cpp_dtnorm(x, mean, sd, a, b, log[1L])
}
<environment: namespace:extraDistr>
and so it seems that the R function just calls the respective c++ version, that is called cpp_dtnorm.
Since I'm writing the C++ and I need to use some of the functions included in this package, are there some ways to call directly the cpp_ functions without passing through the "R versions"?
Maybe it should be sufficient to find the script with the cpp_ function in the package directory, copy the code of interest and paste it into my script, but actually I do not know where I can find it. Can you help me in some ways?
Thank you all.