[Rcpp-commits] r1896 - pkg/Rcpp/inst/doc/Rcpp-quickref
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jul 30 17:14:28 CEST 2010
Author: edd
Date: 2010-07-30 17:14:28 +0200 (Fri, 30 Jul 2010)
New Revision: 1896
Modified:
pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw
Log:
colon is less offensive that dot
Modified: pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw 2010-07-30 15:06:28 UTC (rev 1895)
+++ pkg/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw 2010-07-30 15:14:28 UTC (rev 1896)
@@ -30,32 +30,32 @@
\maketitle
\thispagestyle{empty}
-% FIXME: without the dot, latex does not want to newline
-\paragraph{Create simple vectors}.\newline
+% without the colon, latex does not want to newline
+\paragraph{Create simple vectors}: \newline
<<lang=cpp>>=
SEXP x ; std::vector<double> y(10) ;
// from SEXP
NumericVector xx(x) ;
-
+
// of a given size (filled with 0)
-NumericVector xx(10) ;
+NumericVector xx(10) ;
// ... with a default for all values
NumericVector xx(10, 2.0) ;
// range constructor
-NumericVector xx( y.begin(), y.end() ) ;
+NumericVector xx( y.begin(), y.end() ) ;
// using create
-NumericVector xx = NumericVector::create(
+NumericVector xx = NumericVector::create(
1.0, 2.0, 3.0, 4.0 ) ;
-NumericVector yy = NumericVector::create(
- _["foo"] = 1.0,
- _["bar"] = 2.0 ) ;
+NumericVector yy = NumericVector::create(
+ Named["foo"] = 1.0,
+ _["bar"] = 2.0 ) ; // short for Named
@
-\paragraph{Extract and set single elements}.\newline
+\paragraph{Extract and set single elements}:\newline
<<lang=cpp>>=
// extract single values
@@ -75,22 +75,22 @@
yy["foobar"] = 10.0 ;
@
-\paragraph{STL interface}.\newline
+\paragraph{STL interface}:\newline
<<lang=cpp>>=
-std::accumulate( xx.begin(), xx.end(),
+std::accumulate( xx.begin(), xx.end(),
std::plus<double>(), 0.0 ) ;
int n = xx.size() ;
@
-\paragraph{Function}.\newline
+\paragraph{Function}:\newline
<<lang=cpp>>=
Function rnorm("rnorm") ;
rnorm(100, _["mean"] = 10.2, _["sd"] = 3.2 );
@
-\paragraph{Environment}.\newline
+\paragraph{Environment}:\newline
<<lang=cpp>>=
Environment stats("package:stats") ;
@@ -126,12 +126,12 @@
\newpage
-\paragraph{Rcpp sugar}.\newline
+\paragraph{Rcpp sugar}:\newline
<<lang=cpp>>=
-NumericVector x = NumericVector::create(
+NumericVector x = NumericVector::create(
-2.0, -1.0, 0.0, 1.0, 2.0 ) ;
-IntegerVector y = IntegerVector::create(
+IntegerVector y = IntegerVector::create(
-2, -1, 0, 1, 2 ) ;
NumericVector xx = abs( x ) ;
@@ -159,7 +159,7 @@
NumericVector xx = rep_each( x, 3 ) ;
IntegerVector yy = rev( y ) ;
-@
+@
\end{document}
More information about the Rcpp-commits
mailing list