[R-pkg-devel] Including Rcpp in an existing package
Dirk Eddelbuettel
edd at debian.org
Thu Dec 22 20:35:26 CET 2016
On 22 December 2016 at 14:15, Duncan Murdoch wrote:
| On 22/12/2016 1:55 PM, Glenn Schultz wrote:
| > All,
| > My package was not initially built with the rcpp use in mind. I have to include C++ source code for a particular project so I will have edit the description file add src files, etc. by hand. I an going over the rcpp documentation now and reviewing the R documentation on extensions as well. Is there anything in particular that I should keep in mind while doing this or is this relatively straightforward.
|
| It should be pretty straightforward. There are lots of examples of
| packages that do it (not all of which are simple); see the list of
| "reverse XXXX" on https://CRAN.R-project.org/package=Rcpp (where XXXX is
| Depends, Imports, Suggests, or LinkingTo).
Exactly. I also (still) hand-edit a chronological list at
http://dirk.eddelbuettel.com/code/rcpp.cranusers.html
which contains a mix of 'fresh packages' (starting from scratch with Rcpp)
and 'converted packages' (which is what you are after). Sadly the latter set
is not indexed, so you have 'know' when a packages was pre-existing when it
made the list.
On 22 December 2016 at 14:22, Ben Bolker wrote:
|
| A mistake that I have made repeatedly is forgetting to add an
| appropriate UseDynLib() call to the NAMESPACE file.
Exactly, as well (though really an issue about going from no src/ to having
src).
For the issue here I recommend creating two _minimal_ packages via, say,
setwd("/tmp") # alter as neded
package.skeleton("fooR")
Rcpp.package.skeleton("fooRcpp")
and the study where/how they differ. And maybe try to convert fooR into
fooRwithRcpp.
There is a dedicated list for Rcpp questions too.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the R-package-devel
mailing list