

The good news is that we can use C++ code within R and Python, and this blog post is about using C++ functions from R.Īlso, I do not pretend to be an expert on C++ or debate if R is better than Python. The GEPPML estimator is a computationally intensive estimator that requires to solve a system of non-linear equations, and for this task we might be better-off by using a compiled language such as C++.

MotivationĪ large part of my research interest requires to estimate computationally intensive models, such as the General Equilibrium Poisson Pseudo Maximum Likelihood (GEPPML) estimator derived from the equilibrium conditions introduced by Anderson and Van Wincoop (2004) for estimation and inference. As Mark Padgham correctly mentioned, it is just for debugging purposes and makes compilation slower. Updated (2nd time) : I added a note about removing the “-g” flags in the “Makevars” file once everything works correctly. In the vendoring post I refined what to include to compile and explicitly imported specific headers for doubles (i.e., numeric vectors) and matrices excluding calls to lists, strings and others. Also, if we include “cpp11.hpp”, then we don’t need to call “doubles.hpp” and “matrix.hpp”, therefore I simplified the example here and just included “cpp11.hpp” to build the package. I modified this post and the repository to do the same here for consistency. Updated : In a posterior post about a more advanced C++ option called vendoring I used the convention that functions with names ending in underscore are “development” functions and those without it are “end-user” functions. Additionally, I provide training services in the Spanish language and am available to discuss means by which I may contribute to your Shiny project. R and Shiny Training: If you find this blog to be interesting, please note that I offer personalized and group-based training sessions that may be reserved through Buy me a Coffee.
