Rcpp11 is an R package shipping a C++11 library facilitating integration between R and C++.
Questions tagged [rcpp11]
49 questions
2
votes
1 answer
Rcpp::DataFrame::create is limited by 20 arguments?
We are creating the following dataframe inside an Rcpp function:
Rcpp::DataFrame res =
Rcpp::DataFrame::create(
Rcpp::Named("A")=a
,Rcpp::Named("B")=b
,Rcpp::Named("C")=c
,Rcpp::Named("D")=d
,Rcpp::Named("E")=e
…

Dimon
- 436
- 5
- 15
2
votes
1 answer
Load shared object in Rcpp package
I want to include ./libdynamic/dynamic.h to my package with Rcpp. Directory libdynamic is nested in the project's folder src.
While I am trying to build a R package, I face dyn.load error.
Error in dyn.load(file, DLLpath = DLLpath, ...) :
…

Cron Merdek
- 1,084
- 1
- 14
- 25
2
votes
0 answers
Rows of Rcpp::DataFrame
I have this code
// [[Rcpp::export]]
void testDf(Rcpp::DataFrame pq)
{
Rcpp::NumericVector p = pq[1];
std::cout<

srinath29
- 345
- 2
- 4
- 14
1
vote
1 answer
Rf_allocVector only allocates and does not zero out memory
Original motivation behind this is that I have a dynamically sized array of floats that I want to pass to R through Rcpp without either incurring the cost of a zeroing out nor the cost of a deep copy.
Originally I had thought that there might be…

Terrryyy1
- 31
- 4
1
vote
0 answers
Add multiple columns to a dataframe based on rolling calculations performed on another column in R
Wondering if anyone can suggest a more succinct alternative to achieve the same outcome as below?
I have a dataframe with three columns date, time, and rain. It is a dataset of hourly rainfall records. I want to create 96 new columns. Each new…

nomis
- 11
- 2
1
vote
1 answer
In Rcpp How to create a NumericMatrix by a NumbericaVector?
In Rcpp How to create a NumericMatrix by a NumbericaVector?
Something like
// vector_1 has 16 element
NumericMatrix mat = NumericMatrix(vector_1, nrow = 4);
Thanks.

Justin
- 327
- 3
- 13
1
vote
0 answers
How can I calculate the time interval in rcpp?
I want to record my computing time for a for loop function. I write the function by rcpp, and use std::clock to measure the time interval. The rcpp code is as follow:
// [[Rcpp::depends(RcppArmadillo)]]
#include…

Xia.Song
- 416
- 3
- 15
1
vote
1 answer
Rcpp share same roxygen between two functions
Consider the following functions:
//' Provides some stuff AB
//' @param a integer that responsible for stuff A
//' @param b integer that responsible for stuff B
//' @export
// [[Rcpp::export]]
NumericVector foo1(int a, int b)
{
//some code
}
//'…

Bogdan
- 864
- 10
- 18
0
votes
0 answers
Compiling C++ with R using sourceCPP
THIS QUESTION PERTAINS TO WINDOWS 10. There is a similar question but that does not answer or resolve the issue that I am facing.
I have a C++ function written and am using sourceCpp to compile. I have specified a directory location so I know where…

Ramesh Kadambi
- 546
- 6
- 17
0
votes
1 answer
Trying to move numbers in NumericMatrix
I am created a double for loop in Rcpp to move up one cell all 1's in a column that has 5 in the next available cell. When I compile the code I don't get any error but the code does move 1's in the matrix, it just returns the same matrix. Let's take…

KEN
- 55
- 5
0
votes
2 answers
Register C++ version of Rcpp function and use it within the other Rcpp function in a new package
I have a package hpa that has some functions written in Rcpp. I want to use some of these functions within my new R-package. It is necesseraly to use this functions in "Rcpp form" in order to avoid perfomance penalty so I can't to export them in a…

Bogdan
- 864
- 10
- 18
0
votes
1 answer
Create diagonal matrix in Rcpp but the result is wrong
The code is supposed to create a diagonal matrix with value 1.
// [[Rcpp::export]]
NumericMatrix filterOne(int g_size){
NumericMatrix filter(g_size, g_size);
int ptr, ptr2;
for(ptr=0;ptr

Justin
- 327
- 3
- 13
0
votes
2 answers
Is there a way to check the arity of Rcpp::Function?
I need to check the arity of a function in an Rcpp block at run time. What I would like to do is something akin to the following:
double loglikelihood(Rcpp::List data, Rcpp::List params, SEXP i, Rcpp::RObject custom_function) {
Rcpp::Function f…

kreld
- 732
- 1
- 5
- 16
0
votes
1 answer
Rcpp: how to combine the R function and Rcpp function together to make a package
Suppose I have the following c++ code in a file named test.cpp
#include
//[[Rcpp::export]]
Rcpp::NumericMatrix MyAbar (const Rcpp::NumericMatrix & x, int T){
unsigned int outrows = x.nrow(), i = 0, j = 0;
double d;
…

Nicolas H
- 535
- 3
- 13
0
votes
0 answers
Rcpp maximum value by removing several element
I'm trying to write down the distance function which calculate the maximum distance between each rows of matrix, however, before calculate the maximum value, I need to remove certain element, the question is posted in the code.
How can I accomplish…

Nicolas H
- 535
- 3
- 13