[Rcpp-commits] r3635 - in pkg/Rcpp/inst: doc/Rcpp-modules skeleton

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 21 15:54:12 CEST 2012


Author: edd
Date: 2012-06-21 15:54:11 +0200 (Thu, 21 Jun 2012)
New Revision: 3635

Modified:
   pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
   pkg/Rcpp/inst/skeleton/zzz.R
Log:
added some Rcpp modules documentation updates for loadRcppModules and loadModule


Modified: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2012-06-21 11:56:11 UTC (rev 3634)
+++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2012-06-21 13:54:11 UTC (rev 3635)
@@ -1161,6 +1161,21 @@
 from the module is exposed directly in the package namespace. If set to
 \texttt{FALSE}, all content is exposed as components of the module.
 
+Starting with release 0.9.11, an alternative is provided by the
+\code{loadModule()} function which takes the module name as an argument.
+It can be placed in any \code{.R} file in the package. This is useful as it allows to load
+the module from the same file as some auxiliary \R functions using the
+module. For the example module, the equivalent code to the \code{.onLoad()}
+use shown above then becomes
+
+<<eval=FALSE>>=
+loadModule("yada")
+loadModule("stdVector")
+loadModule("NumEx")
+@
+
+This feature is also used in the new Rcpp Classes introduced with Rcpp 0.9.11.
+
 \subsubsection{Just expose the module}
 
 Alternatively, it is possible to just expose the module to the user of the package,

Modified: pkg/Rcpp/inst/skeleton/zzz.R
===================================================================
--- pkg/Rcpp/inst/skeleton/zzz.R	2012-06-21 11:56:11 UTC (rev 3634)
+++ pkg/Rcpp/inst/skeleton/zzz.R	2012-06-21 13:54:11 UTC (rev 3635)
@@ -5,11 +5,11 @@
     loadRcppModules()
 }
 
-## For R 2.15.1 and later this will work
-#evalqOnLoad({
-#    loadModule("NumEx", TRUE)
-#    loadModule("yada", TRUE)
-#    loadModule("stdVector", TRUE)
+## For R 2.15.1 and later this will work. Note that calling loadModule() triggers
+## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad().
+#  loadModule("NumEx", TRUE)
+#  loadModule("yada", TRUE)
+#  loadModule("stdVector", TRUE)
 #})
 
 



More information about the Rcpp-commits mailing list