Rcpp and especially RcppArmadillo with its nice syntax have developed into an extremely powerful tool for R. The concept of vectors and matrices is transported into C, and the extra effort in coding isn't that big anymore. RStudio even syntax highlights the C++ code and offers a 'source' button which runs the sourceCpp comand from the Rcpp package.
More tutorials are being written, but I just want to provide some simple examples. Let's start with a simple inverse CDF approach to drawing from a univariate truncated Normal distribution:
More tutorials are being written, but I just want to provide some simple examples. Let's start with a simple inverse CDF approach to drawing from a univariate truncated Normal distribution:
Then it is straightforward to source the code in R.