Questions tagged [rcpp]
Rcpp provides seamless integration of C++ code in R.
rcpp
3,075
questions
1
vote
1
answer
43
views
Failing to compile package from Mac [duplicate]
I'm trying to install a package in R, and I get the following error:
clang: error: unsupported option '-fopenmp'
This, is after I got an error:
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-...
0
votes
1
answer
29
views
Cannot compile with RcppParallel on Windows
I have installed Rcpp, RcppParallel and I was testing simple function, written in .cpp file.
#include <RcppParallel.h>
#include <Rcpp.h>
#include <vector>
using namespace ...
0
votes
0
answers
26
views
sourceCpp error: G__~1.EXE: error: unrecognized command line option '-std=gnu++17'
I switched from R-3.6.3 to R-4.3.1 and R-4.4.1.
I tried to sourceCpp() some *.cpp which worked fine for R-3.6.3, but not for R-4.3.1 and R-4.4.1. The error is copied below.
Rcpp::evalCpp("2 + 2&...
1
vote
0
answers
34
views
How to move all individuals from one class to another at specific time step Boost ODE C++
I am trying to write a system of differential equations that can account for fecundity and maturation occurring at specific time steps throughout the years. Currently, this is the code that I have set ...
1
vote
1
answer
66
views
Docker image build not working for glmnet and Amazon Linux
I am creating a Dockerfile to run R workloads in Lambda based on a template from the lambdr package, which relies on an Amazon Linux base image and yum package manager. I need glmnet for one of the ...
1
vote
1
answer
76
views
How can I re-install a R package which uses Rcpp?
In brief: I never faced the problem that I can install a package, but I am not able to re-install the unchanged package. How can I solve that problem? It only affects a package which uses Rcpp - all ...
2
votes
0
answers
49
views
Minimal reproducible example package using Rcpp does not work
In short: I tried with SO and chatGPT, at some point I thought the NAMESPACE file was the error and deleted it. However, I still get an error when I run
Rcpp::compileAttributes(pkgdir = "...
0
votes
0
answers
34
views
Rcpp won't export an inline void function
The simple code file test2.cpp is
double tau;
// [[Rcpp::export]]
inline void set_tau(double t) {
tau = t;
}
// [[Rcpp::export]]
inline double get_tau() {
return tau;
}
It won't compile with ...
0
votes
1
answer
43
views
Where should RcppEigen be in description file
I'm unsure how to only put RcppEigen under the LinkingTo and not the Imports headers. I've gotten conflicting instructions and am very confused what to do. I've been learning how to use Eigen myself, ...
1
vote
2
answers
96
views
Why do these #include RcppArmadillo cause R to compile Rcpp code with C++11 instead of C++17 on Ubuntu 22.04?
I have recently started using a machine with Ubuntu 22.04 and I find that my existing (windows) .cpp files are no longer compiling with sourceCpp. The issue is that I require a compilation with at ...
0
votes
1
answer
31
views
arma::mat division by const integer causes problems
I have a function I call from R using Rcpp. I pass an argument, which is a const unsigned integer, to this function. The integer is used to scale a matrix consisting of random draws. MWE:
Rcpp::...
0
votes
1
answer
55
views
Fixing Compilation Errors and Creating an R Function from Rcpp Code [closed]
I try to implement RCPP code for the R function below. I'm very new to C++. Below I put R function and the RCPP function. The errors occur in the C++ script lines 43,44,50,51,55.
#include <Rcpp.h&...
1
vote
0
answers
36
views
Failure to install "RcppArrayFire" package in R because of "This package has a configure script, It probably needs manual configuration..."
I'm trying to install the package "RcppArrayFire" in R v4.3.2.
After having gone round in circles following multiple attempts at various possible ways of installing a package in R, I'm ...
3
votes
0
answers
67
views
Class constructor using reference tor Rcpp::NumericVector
this code (content of file src.cpp)
#include <Rcpp.h>
#include <vector>
#include <string>
template<typename T>
class baseX{
private:
protected:
std::string N_;
std::vector&...
0
votes
0
answers
51
views
Walk forwards optimization Rcpp code crashes Rstudio
I am trying to implement walk forward optimization using Rcpp R package. I don't have expirence wih Rcpp and C++, so kindly ask for help.
Here is the Rcpp code that implements simple backtesting ...