[Rcpp-devel] Using Rcpp in a package only as an option?

Dirk Eddelbuettel edd at debian.org
Fri Aug 16 18:52:37 CEST 2013


On 16 August 2013 at 19:36, Tal Galili wrote:
| Hello dear list members,
| 
| Following previous correspondence, I wish to use an Rcpp function inside a
| package I'm authoring.
| However, I do not wish to force the user to install Rcpp, and if he does not
| wish to do so, I want to let him "fall back" on an R written function (which is
| 20-40 times slower, but it works).
| Looking at this Vignettes:
| http://cran.rstudio.com/web/packages/Rcpp/vignettes/Rcpp-package.pdf
| I see that including Rcpp in a package require the use of "depends" in
| DESCRIPTION.
| Is there a way to have Rcpp as "Suggests", and to later use "require" when
| loading the package, to decide if to load the Rcpp function or the R function?
| (alternatively, I could have a separate package only for that function, but
| that feels a bit like a "hack" to me)

If the code is used (ie not commented out) then it must be compiled and
linked and you must have the depends.

Your only choice may be to author two packages  'foo'  and   'fooFast'
where only the latter uses Rcpp.

Dirk
 
| Thoughts?
| 
| With regards,
| Tal
| 
| 
| 
| 
| 
| ----------------Contact
| Details:-------------------------------------------------------
| Contact me: Tal.Galili at gmail.com| Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
| www.r-statistics.com (English)
| ----------------------------------------------------------------------------------------------
| 
| 
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list