Moving from sourceCpp to a package w/Rcpp

后端 未结 3 1318
面向向阳花
面向向阳花 2020-12-28 09:48

I currently have a .cpp file that I can compile using sourceCpp(). As expected the corresponding R function is created and the code works as expect

3条回答
  •  时光说笑
    2020-12-28 10:08

    In short, the trick is to call compileAttributes() from within the root of the package. So for instance for package foo

    $ cd /path/to/foo
    $ ls
    DESCRIPTION  man  NAMESPACE  R  src
    $ R
    R> compileAttributes()
    

    This command will generate the RcppExports.cpp and RcppExports.R that were missing.

提交回复
热议问题