arrow-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin McLean <>
Subject [R and C++] passing arrow::Arrow from R to C++ for reading and writing?
Date Mon, 12 Oct 2020 08:49:41 GMT
Dear Arrow users,

  I was wondering if anyone can help me understand how I can create an  
arrow::Array object in R, then pass this into C++ (using the Rcpp  
library) for both reading and writing too? Similar what is done using  
the R bigmemory  
( or  
bigstatsr packages.

Kindest Regards,
Colin Mclean.

R script:

## compile c++ code
Sys.setenv("PKG_CXXFLAGS" = "-larrow")

N = 10
X = arrow::Array$create(rep(0,N*N))

test( X$pointer() )

// define headers
// [[Rcpp::plugins(cpp11)]]
// [[Rcpp::depends(arrow)]]

#include <arrow/api.h>
#include <arrow/array.h>
#include <arrow/array/array_base.h>
#include <Rcpp.h>
#include <stdio.h>
#include <iostream>
#include <string>

using namespace Rcpp;
using namespace std;

// [[Rcpp::export]]
void test( XPtr<arrow::Array> aAPtr ){

   cout << "read & write arrow::Array in test " << endl;
   cout << aAPtr << endl;


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

View raw message