Based on other answers, here is a sample code:
#include <Rcpp.h> using namespace Rcpp ; // [[Rcpp::export]] double do_stuff_with_a_data_table(DataFrame df){ CharacterVector x = df["x"] ; NumericVector y = df["y"] ; IntegerVector z = df["v"] ; /* do whatever with x, y, v */ double res = sum(y) ; return res ; }
So, as Matthew says, this refers to data.table as a data.frame (aka a Rcpp::DataFrame in Rcpp ).
require(data.table) DT <- data.table( x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9) do_stuff_with_a_data_table( DT )
This completely ignores the internal data.table elements.
Romain francois
source share