Category : rcpp

I just finished re-installing both Xcode and CLT on my Mac running Big Sur 11.4. I’m working in RStudio Version 1.4.1717 with R 4.1.1 I then ran devtools::has_devel() to ensure things were installed properly and they weren’t. I received the message Error: Could not find tools necessary to compile a package Call pkgbuild::check_build_tools(debug = TRUE) ..

Read more

Trying to get Rcpp to work on R 4.1.2 on Mac OS Monterey using an Intel computer. > library(Rcpp) > evalCpp("2 + 2") clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include" -I"/private/var/folders/jz/977gqfr957g_rlgw1h05152w0000gq/T/Rtmp8hmDZ5/sourceCpp-x86_64-apple-darwin17.0-1.0.8" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c file152f71a55f97c.cpp -o file152f71a55f97c.o clang++ -mmacosx-version-min=10.13 -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ..

Read more

After updating my Mac from intel to m1, I ran into the problem while installing the rcpp and trying helloworld.cpp example. I pretty much followed these instructions. https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ with the right gfortran version (https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/12-arm-alpha) what I get is this: Rcpp::sourceCpp(‘/Users/nikitaabalakin/helloworld.cpp’) ^ helloworld.cpp:18:7: error: no member named ‘sourceCpp’ in namespace ‘Rcpp’ Rcpp::sourceCpp(‘/Users/nikitaabalakin/helloworld.cpp’) ~~~~~~^ helloworld.cpp:18:17: warning: multi-character ..

Read more

I get such warnings when I run R CMD CHECK on my package, which uses Rcpp, RccpCGAL, BH and RcppEigen (below is a copy of one of these warnings triggered on R-hub): C:/Users/USEReBkhIMHdJz/AppData/Local/R/win-library/4.2/BH/include/boost/container/detail/copy_move_algo.hpp:184:19: warning: ‘void* memmove(void*, const void*, size_t)’ writing to an object of type ‘value_type’ {aka ‘struct std::pair, std::allocator >, long long unsigned int> ..

Read more

I am writing an R package + Rcpp code to work with an existing C++ library. After going through the tutorials here: https://gallery.rcpp.org/articles/optional-null-function-arguments/ , I’m struggling with how to work with NULL and strings. I am confused that I cannot cast from type Rcpp::Nullable<std::string> to std::string (or equivalently Rcpp::Nullable<Rcpp::String> to Rcpp::String Within C++, I am ..

Read more

I’m frequently using std::map<std::string, arma::vec> in c++ so I wrote custom as and wrap templates to handle the R-C++ conversion. Below is a minimal reprex: // [[Rcpp::depends(RcppArmadillo)]] #include <RcppArmadillo.h> // forward declarations namespace Rcpp { template <> inline std::map<std::string, arma::vec> as(SEXP matsexp) { Rcpp::NumericMatrix mat(matsexp); std::vector<std::string> cn = Rcpp::as<std::vector<std::string>>(Rcpp::colnames(mat)); std::map<std::string, arma::vec> map; for (unsigned int ..

Read more