Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [rcpp]

Rcpp provides an API on top of R, permitting direct interchange of rich R objects between R and C++.

4
votes
1answer
41 views

Generating random sparse matrix

My goal is to generate a large sparse matrix with majority (~99%) zeros and ones. Ideally, I would be working with 10,000 rows and 10,000,000 columns. Additionally, each column is generated as a ...
5
votes
1answer
68 views

Passing uint64_t from C++ to R: Hilbert Mapping - xy2d function

I have been working with Rcpp to perform a forward and backward Hilbert Mapping. Below is an implementation based on this code. My application is in genomics and I may be dealing with enormous ...
1
vote
1answer
52 views

linearly interpolate NA values in Rcpp::NumericVector

I am trying to fill missing values with linearly interpolated values in an Rcpp::NumericVector -- leaving in place leading and trailing NA-values. The desired ...
2
votes
2answers
49 views

Trim NA values from left and right of Rcpp::NumericVector

I receive data with NA values. I would like to trim off the leading and trailing NA values, but to leave the interior NA values in place. I've written the below in Rcpp, but it is very much a hand ...
3
votes
1answer
143 views

Effective 3d array transposition with R/C++ (Rcpp)

Task is reshape 3d array from [row, col, slice] to [slice,row,col]. I tried implement base::aperm analog with Rcpp. ...
1
vote
1answer
136 views

Efficiently sample a single row of an array at random

I have the following C++ code snippet that randomly samples a single row in an array called pop with num_specs columns and ...