[Rcpp-commits] r1446 - pkg/Rcpp/inst/doc/Rcpp-package
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jun 6 10:47:44 CEST 2010
Author: romain
Date: 2010-06-06 10:47:43 +0200 (Sun, 06 Jun 2010)
New Revision: 1446
Modified:
pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw
Log:
minor typos and actually show the package being run (install on a temporary library)
Modified: pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw 2010-06-06 02:58:36 UTC (rev 1445)
+++ pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw 2010-06-06 08:47:43 UTC (rev 1446)
@@ -77,7 +77,7 @@
\noindent This document provides a short overview of how to use
\pkg{Rcpp}~\citep{CRAN:Rcpp} when writing an \proglang{R} package. It
shows how usage of the function \Sexpr{link("Rcpp.package.skeleton")}
- creates a complete and self-sufficient example package using
+ which creates a complete and self-sufficient example package using
\pkg{Rcpp}. All components of the directory tree created by
\Sexpr{link("Rcpp.package.skeleton")} are discussed in detail. This
document thereby complements the \textsl{Writing R Extensions}
@@ -133,6 +133,9 @@
dir.create( gendir )
setwd( gendir )
Rcpp.package.skeleton( "mypackage" )
+dir.create( tlib <- tempfile() )
+system( sprintf( 'R CMD INSTALL --library="%s" mypackage ', tlib ) )
+require( "mypackage", lib.loc = tlib )
@
% <<>>=
@@ -198,7 +201,7 @@
\proglang{R} side and the \proglang{C++} side. \proglang{R} objects
(\texttt{SEXP}) can be conveniently manipulated using the \pkg{Rcpp} API.
-Noe that in this example, no arguments were passed from \proglang{R} down to
+Note that in this example, no arguments were passed from \proglang{R} down to
the \proglang{C++} layer. Doing so is straightforward (and one of the key
features of \pkg{Rcpp}) but not central to our discussion of the package
creation mechanics.
@@ -214,7 +217,7 @@
The header includes the \texttt{Rcpp.h} file, which is the only file that
needs to be included to use \pkg{Rcpp}. The function is then implemented in
-the \texttt{rcpp\_hello\_world.rcpp} file
+the \texttt{rcpp\_hello\_world.cpp} file
<<echo=FALSE,results=tex>>=
ex_highlight( file.path( gendir, "mypackage", "src", "rcpp_hello_world.cpp" ) )
@@ -223,8 +226,12 @@
The function creates an \proglang{R} list that contains a
\Sexpr{link("character")} vector and a \Sexpr{link("numeric")} vector using \pkg{Rcpp}
classes. At the \proglang{R} level, we will therefore receive a list of
-length two containing these two vectors.
+length two containing these two vectors:
+<<>>=
+rcpp_hello_world( )
+@
+
\subsection{\texttt{DESCRIPTION}}
The skeleton generates an appropriate \texttt{DESCRIPTION} file, using
More information about the Rcpp-commits
mailing list