Debug C++ (cpp11) code in R to evaluate functions with integers or doubles

Provide a reprex? See the FAQ. Include working C++ as standalone.