In all Rcpp examples that I could find, one must know the type of DataFrame columns, then you can extract column into vector, e.g.:
// construct the data.frame object
Rcpp::DataFrame DF = Rcpp::DataFrame(Dsexp);
// and access each column by name
Rcpp::IntegerVector a = DF["a"];
Rcpp::CharacterVector b = DF["b"];
Rcpp::DateVector c = DF["c"];
In R, one could find column types using sapply() function and class or typeof.
However, I couldn't find the external API in Rcpp responsible for type checking. Is there a way to find column type programmatically?
TYPEOF()andR_data_class()over each column; they return aSEXPTYPEandSEXP (STRSXP)respectively. - alexis_laz