Questions tagged [rcpp]
Rcpp provides seamless integration of C++ code in R.
2,530
questions
-1
votes
0answers
14 views
I wanna a small and good code in cpp using graphics library, please. Or a website that has some code inside [closed]
Using graphics.h in cpp and send to me something good ,please.
My teacher want me write a code using graphics.h in cpp without any teaching at all about graphics I try to write one but I cannot and I ...
0
votes
1answer
36 views
add and Rcpp file to an existing r Package?
I have already made a simple R package (pure R) to solve a problem with brute force then I tried to faster the code by writing the Rcpp script. I wrote a script to compare the running time with the &...
0
votes
2answers
64 views
About the use of .shed_row/.shed_col in RcppArmadillo
I am now trying to convert R code to Rcpp code.
The R code is
hh <- function(A,B,j){
aa <- A[j,-j] %*% B[j,-j] ## A and B are n*m matrixes
return(aa)
}
> set.seed(123)
> A <- ...
0
votes
0answers
25 views
Futhark in an R package via Rcpp
I would like to call functions written in the small functional programming language Futhark in R via Rcpp. That works, because the Futhark compiler can generate C code and C libraries can be accessed ...
0
votes
1answer
32 views
Rcpp: Storing elements to subset of vector
I'm still wrapping my head around Rcpp logic coming from an R context, so please be patient with me! From the following code:
Cjplus <- c(0,0)
Kseq <- c(1,2)
cand <- c(0,1)
cppFunction("...
0
votes
1answer
32 views
seq_len not recognized in rcpp
I'm new to Rcpp, and this may be a silly question, but I can't seem to get seq_len to work in rcpp, even though I know it should be an R-like function that Rcpp has. This is my code:
cppFunction("...
0
votes
1answer
37 views
How to convert seq_len into Rcpp equivalent
I just started learning Rcpp, and I'd like to convert the following function into Rcpp:
foo <- function(N) {
out <- c()
for (i in (seq_len(N-1)+1)){
out[i-1] <- i + 1
}
...
3
votes
1answer
34 views
Rcpp produces different output when not printing blank line
I’m trying to write a function that takes in a vector of 0's and 1's (input), and returns a vector equal to the first, but with each element overwritten by 0 if any previous element was 0 (res). The ...
2
votes
2answers
198 views
Using #include <vector> fails checking R package
I am building a package for R in c++. How can I include libraries in the code?. For example, if I use #include <vector> vector, R check fails with error
> fatal error: vector: No such file or ...
-1
votes
2answers
53 views
R: where to find the source code for all Rfast functions
I have just found an incredibly useful package called Rfast which uses Rcpp to perform routine operations. So I would like to extend my thanks to them for their work, as well as to the creators of ...
0
votes
0answers
28 views
R packages installations give a `::std::isxdigit' declared here fatal error`
I recently updated the Homebrew on my Mac (10.14.6 (18G6020)), and went ahead to recompile the development version of R. I built an installation script to make sure the same steps are taken every ...
0
votes
1answer
29 views
Using custom Rcpp class in rcpp-function in an R-package. Both class and function are defined in the same .cpp file
I'm trying to speed up a loop over the dimensions of an R-array using Rcpp.
The array class is from the rcpp-gallery: (https://github.com/RcppCore/rcpp-gallery/blob/gh-pages/src/2014-03-21-simple-...
-1
votes
0answers
49 views
Rcpp and CharacterMatrix conversion error
Is it expected that Rcpp can convert into CharacterMatrix only an R matrix and not a data.table or a data.frame? Any workaround to work with these? I get the following Error in contains_cpp(tosearch, ...
0
votes
1answer
45 views
Is there a way to mute warning in RcppArmadillo `arma::solve`?
When X is singular, the following code throws a warning. Is there a way of muting it?
"warning: solve(): system seems singular; attempting approx solution"
Function:
// [[Rcpp::depends(...
0
votes
0answers
41 views
Rcpp (function with default null parameter): Not compatible with requested type: [type=NULL; target=double]
My Rcpp code is shown here, I have used sourceCpp to compile the cpp file. No error is reported, just some warnings there. When I tried to implement the function softImpute using softImpute(m1, NULL, ...