Rcpp11 is an R package shipping a C++11 library facilitating integration between R and C++.
Questions tagged [rcpp11]
49 questions
0
votes
0 answers
Rcpp::abs defaults to int instead of double?
Source the following cpp file in RStudio and you see that Rcpp::abs is returning an integer when I was hoping for a double. std::abs solves the issue. I assume my expectation is wrong, but why is that? Why should it return an integer here (granted,…

jks612
- 1,224
- 1
- 11
- 20
0
votes
0 answers
Return a dataset using Rcpp function
I am using a truely wonderfull package Rcpp to pass my C++ function dataset(name) which generates synthetic datasets to R. One of the datasets constant_file is not generated/sampled, but is contained in an .Rdata file. Is it possible to return it…

qarabala
- 178
- 10
0
votes
1 answer
Rcpp override summary method for custom class
Suppose I have the following function:
List foo(List x)
{
x.attr("class") = "myOwnClass";
return(x);
}
I whant to override R summary method for foo function output. However the following R-style approach does not work:
List…

Bogdan
- 864
- 10
- 18
0
votes
1 answer
Rcpp formula input argument
I want to create Rcpp function which input value is R formula. When I use String as an input for a function I get error in R when I writing formula in not string format (if I provide formula like a string in R then all works right). Please provide…

Bogdan
- 864
- 10
- 18
0
votes
2 answers
R package build error: '-std=c++11 or -std=gnu++11 compiler options'
I am trying to build an R package which includes Rcpp and RcppArmadillo code. sourceCpp() works fine and everything runs smoothly, but when I try to build the package I get: "This file requires compiler and library support for the
ISO C++ 2011…

Seth
- 19
- 4
0
votes
0 answers
Fast element-wise access in Eigen::SparseMatrix in Latent Dirichlet Allocation
I am implementing Latent Dirichlet Allocation (LDA) in Rcpp. In LDA, we need to deal with a huge sparse matrix (e.g. 50 x 3000).
I decided to use SparseMatrix in Eigen. However, since I need access to each cell, computationally expensive .coeffRef…

user51966
- 967
- 3
- 9
- 21
0
votes
0 answers
Using pre-assigned value from R outside of cppFunction
I am wondering if there is an easy way to call the pre-assigned values in r when I wrote cppFunction.
Here is my code:
y=45.3
library(Rcpp)
cppFunction(
"NumericVector demo_fun_cpp(double x) {
NumericVector out1(50);
out1[0] = 2;
for…

Joanna
- 663
- 7
- 21
0
votes
0 answers
Automatic generation of Makevars and configure files
Friends,
Is there automatic way to generate Makevars and configure? I'm compiling my C++ code using the bash terminal with the g++ compiler.
Example: I have the following code written using the Rcpp.h library where I use a gsl/gsl_sf_bessel.h…

Pedro Rafael
- 492
- 4
- 11
0
votes
1 answer
Multi-armed bandits with Rcpp
I am translating the epsilon-greedy algorithm for multiarmed bandits from here. This is a rather nice demonstration of the power and elegance of Rcpp. However, the results from this version do not tally with the one that is mentioned in the link…

buzaku
- 361
- 1
- 10
0
votes
1 answer
Rcpp - Exposing a C++ function that contains pointers to R
I am using Rcpp to create a package in R that leverages C++ code. I have read all of the Rcpp vignettes, but I haven't been able to find a solution to the following problem.
One of the C++ classes I'm trying to use contains a pointer. I am exposing…

ndroz
- 31
- 2
0
votes
1 answer
Find number of days between two given dates in Rcpp
I'm newbie in Rcpp, but I have a task which's connected with Date and Datetime.
Let me have market data in DataFrame in my Rcpp function. So, Date field has formatting like this:
2016-04-19 00:01:00
Dataframe field name which contains Date values…

Dmitriy
- 847
- 17
- 39
0
votes
0 answers
My Rcpp code delays to show printed message
I have a Rcpp code inside of which I have a message to be printed out as:
"The no. of iteration is ---" after each 100 iteration. For this I used the code:
Rcout << "The number of iteration is : " << t << "\n";
The problem with this code is that…

gultu
- 143
- 10
0
votes
1 answer
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘Rcpp’
Basically I want to use wordcloud function. I'm working through R console. But I could use Rstudio if thats the problem.
When I use
wordcloud(r_stats_text_corpus)
Error: could not find function "wordcloud"
I also tried
library("wordcloud")
Error…

tikiabbas
- 119
- 2
- 3
- 11
0
votes
1 answer
Rcpp C++11 .Call issues under Windows
I'm experiencing .Call issues when running functions built with Rcpp on Windows, if my c++ code uses C++11 std::regex and I have found no way out so far.
Unlike prior questions on similar issues, I have had neither building nor linking issues.…

Fab
- 1
- 1
0
votes
1 answer
RCpp Temporary Build Location
I work in an environment where linking of dynamic libraries are restricted to certain locations. When I use RStudio and request a new C++ file I get the "Hello World" template. When I try to compile that and link that in by clicking on "Source" in…

Justace Clutter
- 2,097
- 3
- 18
- 31