2013-07-02から1日間の記事一覧

一括してsourceCpp() たくさんcppファイルを作ったら

練習でたくさんのcppファイルを作ると、sourceCpp("hoge.cpp")が面倒くさくなる ので、ディレクトリの中のcppファイルのリストを作って、一括して処理 library(Rcpp) library(RcppArmadillo) sourceCpp.list <- function(files,silent=TRUE){ for(i in 1:len…

ウェブサイトの例をなぞってみる

Rcpp Galleryから Calling R Functions from C++ C++内でRの関数を使う #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] NumericVector callFunctionInt2Vector(int x, Function f) { NumericVector res = f(x); return res; } > sourceCpp("callFunct</rcpp.h>…