[Rcpp-devel] How do I convert my prototyped code to a package ?

Dirk Eddelbuettel edd at debian.org
Sat Sep 7 23:19:51 CEST 2013


On 7 September 2013 at 17:38, Ricardo Silva wrote:
| Hi,
| 
| following
| 
| http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf

Good start.
 
| and this
| 
| help("package.skeleton-methods")

Good too, but please also read

   help("rcpp.package.skeleton")

and use it to __create a working Rcpp package__ into which you simply copy
your working prototype.

Read the "Writing R Extension" manual for general "how do I package with R"
questions; read the Rcpp docs (and particularly the Rcpp-package vignette
and/or Chapter 5 ("Using Rcpp in your package") of the Rcpp book.

Dirk
 
| I use to convert my prototype function as
| 
| 
| functions <- cxxfunction(
| +              list(
| +                      ff = signature(),
| +                      gg = signature( x = "integer", y = "numeric" )
| +              ),
| +              c( "return R_NilValue ;", "return ScalarReal(
| INTEGER(x)[0] * REAL(y)[0] ) ;")
| +      )
| >      package.skeleton( "foobar", functions )
| >> standard package.skeleton from utils
| Creating directories ...
| Creating DESCRIPTION ...
| Error in if (!namespace) warning("From R 2.14.0 on, every package gets
| a NAMESPACE.",  :
|   argument is of length zero
| 
| but now I get the above error,
| 
| someone know what is wrong.
| 
| 
| > sessionInfo()
| R version 3.0.1 (2013-05-16)
| Platform: x86_64-pc-linux-gnu (64-bit)
| 
| locale:
|  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
|  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
|  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
|  [7] LC_PAPER=C                 LC_NAME=C
|  [9] LC_ADDRESS=C               LC_TELEPHONE=C
| [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
| 
| other attached packages:
| [1] RcppArmadillo_0.3.900.0 Rcpp_0.10.3             inline_0.3.13
| 
| loaded via a namespace (and not attached):
| [1] tools_3.0.1
| _______________________________________________
| 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