[Rcpp-commits] r3543 - in pkg/Rcpp: . inst inst/doc/Rcpp-FAQ

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 23 22:00:40 CET 2012


Author: edd
Date: 2012-03-23 22:00:40 +0100 (Fri, 23 Mar 2012)
New Revision: 3543

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/THANKS
   pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw
Log:
small Rcpp-FAQ enhancement based on patch by Glenn Lawyer


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-03-23 20:11:43 UTC (rev 3542)
+++ pkg/Rcpp/ChangeLog	2012-03-23 21:00:40 UTC (rev 3543)
@@ -1,3 +1,9 @@
+2012-03-23  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added short subsection on how to
+	test a package from the command-line, expanding a patch by Glenn
+	Lawyer in response to an initial rcpp-devel post by Dirk
+
 2012-02-16  Dirk Eddelbuettel  <edd at debian.org>
 
         * DESCRIPTION: Release 0.9.10

Modified: pkg/Rcpp/inst/THANKS
===================================================================
--- pkg/Rcpp/inst/THANKS	2012-03-23 20:11:43 UTC (rev 3542)
+++ pkg/Rcpp/inst/THANKS	2012-03-23 21:00:40 UTC (rev 3543)
@@ -8,6 +8,7 @@
 Christian Gunning       for a documentation + unit tests patches and reporting bugs
 Rainer Hurling          for help debugging builds issues on FreeBSD
 Gregor Kastner          for noticing a bug in IntegerVector initialization
+Glenn Lawyer		for sending in documentation patches
 Uwe Ligges              for help with Windows (32 and 64 bit) build issues
 Tama Ma                 for a patch that extends Module constructors
 Karl Millar             for a patch helping with a non-g++ compiler

Modified: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw	2012-03-23 20:11:43 UTC (rev 3542)
+++ pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw	2012-03-23 21:00:40 UTC (rev 3543)
@@ -156,7 +156,7 @@
 vignette( "Rcpp-package" )
 @
 
-\subsection{How do I quickly prototype my code ?}
+\subsection{How do I quickly prototype my code using inline?}
 \label{using-inline}
 
 The \pkg{inline} package \citep{CRAN:inline} provides the functions
@@ -176,7 +176,7 @@
 @
 
 \pkg{Rcpp} uses \pkg{inline} to power its entire unit test suite. Consult the
-\texttt{unitTests} directory of \pkg{Rcpp} for over five hundred further examples.
+\texttt{unitTests} directory of \pkg{Rcpp} for several hundred further examples.
 
 <<eval=FALSE>>=
 list.files( system.file( "unitTests", package = "Rcpp" ), pattern = "^runit[.]" )
@@ -195,6 +195,7 @@
 The \texttt{verbose} argument of \Sexpr{link("cxxfunction")} is very
 useful as it shows how \pkg{inline} runs the show.
 
+
 \subsection{How do I convert my prototyped code to a package ?}
 \label{from-inline-to-package}
 
@@ -205,6 +206,38 @@
 After that you can proceed with working on the package in the spirit of
 \faq{make-package}.
 
+\subsection{How do I quickly prototype my code in a package?}
+\label{using-a-package}
+
+The simplest way may be to work directly with a package.  Changes to both the
+\proglang{R} and \proglang{C++} code can be compiled and tested from the
+command line via:
+
+<<lang=bash>>=
+$ R CMD INSTALL mypkg && Rscript --default-packages=mypkg -e 'someFunctionToTickle(3.14)'
+@
+
+This first installs the packages, and then uses the command-line tool
+\code{Rscript} (which ships with \code{R}) to load the package, and execute
+the \proglang{R} expression following the \code{-e} switch. Such an
+expression can contain multiple statements separated by semicolons.
+\code{Rscript} is available on all three core operating systems.
+
+On Linux, one can also use \code{r} from the \code{littler} package by Horner
+and Eddelbuettel which is an alternative front end to \proglang{R} designed
+for both \verb|#!| (hashbang) scripting and command-line use. It has slightly
+faster start-up times than \code{Rscript}; and both give a guaranteed clean
+slate as a new session is created.
+
+The example then becomes
+
+<<lang=bash>>=
+ $ R CMD INSTALL mypkg && r -l mypkg -e 'someFunctionToTickle(3.14)'
+@
+
+The \code{-l} option calls 'suppressMessages(library(mypkg))' before executing the
+\proglang{R} expression. Several packages can be listed, separated by a comma.
+
 \subsection{But I want to compile my code with R CMD SHLIB !}
 
 The recommended way is to create a package and follow \faq{make-package}. The



More information about the Rcpp-commits mailing list