Rcpp如何在数据框中将DoubleVector转换为IntegerVector

时间:2018-06-19 06:03:13

标签: r rcpp

我构建了一个数据框out。假设数据框中的第一列是使用Rcpp::DoubleVectorREAL()构造的。我想将整个列转换为Rcpp::IntegerVector(非常类似于基数R中的as.integer())。

我试过

out[0] = Rcpp::as<Rcpp::IntegerVector>(out[0]);

但R在转换时返回错误。

有没有办法进行转换?

1 个答案:

答案 0 :(得分:1)

这对我来说很好:

finish()