@@ -144,7 +144,7 @@ NumericVector convolveCpp(NumericVector a, NumericVector b) {
144144The addition of the export attribute allows us to do this from the \proglang {R}
145145prompt:
146146
147- <<eval =FALSE >>=
147+ <<eval =FALSE , lang = r >>=
148148sourceCpp(" convolve.cpp" )
149149convolveCpp(x , y )
150150@
@@ -173,7 +173,7 @@ DataFrame readData(
173173
174174Will be exported to R as:
175175
176- <<lang =r >>=
176+ <<eval = FALSE , lang =r >>=
177177function (file , colNames = character (), commentChar = " #" , header = TRUE )
178178@
179179
@@ -365,7 +365,7 @@ There are several ways to accomplish this, including passing a code
365365string to \texttt {sourceCpp } or using the shorter-form \texttt {cppFunction }
366366or \texttt {evalCpp } functions. For example:
367367
368- <<lang =r >>=
368+ <<eval = FALSE , lang =r >>=
369369cppFunction('
370370 int fibonacci(const int x) {
371371 if (x < 2)
@@ -380,7 +380,7 @@ evalCpp('std::numeric_limits<double>::max()')
380380
381381You can also specify a depends parameter to \texttt {cppFunction } or \texttt {evalCpp }:
382382
383- <<lang =r >>=
383+ <<eval = FALSE , lang =r >>=
384384cppFunction(depends = ' RcppArmadillo' , code = ' ...' )
385385@
386386
@@ -412,14 +412,14 @@ is most conveniently done using the \texttt{Rcpp.package.skeleton} function.
412412To generate a new package with a simple hello, world function that uses
413413attributes you can do the following:
414414
415- <<lang =r >>=
415+ <<eval = FALSE , lang =r >>=
416416Rcpp.package.skeleton(" NewPackage" , attributes = TRUE )
417417@
418418
419419To generate a package based on \proglang {C++} files that you've been using
420420with \texttt {sourceCpp } you can use the \texttt {cpp\_ files } parameter:
421421
422- <<lang =r >>=
422+ <<eval = FALSE , lang =r >>=
423423Rcpp.package.skeleton(" NewPackage" , example_code = FALSE ,
424424 cpp_files = c(" convolve.cpp" ))
425425@
@@ -436,7 +436,7 @@ you need to add these entries.
436436For example, if your package depends on \pkg {Rcpp} and \pkg {RcppArmadillo}
437437you would have the following in your \texttt {DESCRIPTION } file:
438438
439- <<lang =sh >>=
439+ <<lang =bash >>=
440440Depends : Rcpp (> = 0.10.0 ), RcppArmadillo (> = 0.3.4.4 )
441441LinkingTo : Rcpp , RcppArmadillo
442442@
@@ -452,7 +452,7 @@ The \texttt{compileAttributes} function scans the source files within a package
452452for export attributes and generates code as required. For example, executing
453453this from within the package working directory:
454454
455- <<eval =FALSE >>=
455+ <<eval =FALSE , lang = r >>=
456456compileAttributes()
457457@
458458
@@ -499,7 +499,7 @@ NumericVector strLength(CharacterVector str)
499499
500500Results in the following code in the generated \proglang {R} source file:
501501
502- <<lang =r >>=
502+ <<eval = FALSE , lang =r >>=
503503# ' The length of a string (in characters).
504504# '
505505# ' @param str input character vector
@@ -550,7 +550,7 @@ If you request a \texttt{cpp} interface for a source file then
550550(substituting \emph {Package } with the name of the package code is being
551551generated for):
552552
553- <<lang =sh >>=
553+ <<lang =bash >>=
554554inst / include / Package.h
555555inst / include / Package_RcppExports.h
556556@
@@ -601,7 +601,7 @@ compilation of your package source files, you will also need to add the
601601following entry to \texttt {Makevars } and \texttt {Makevars.win } (both are
602602in the \texttt {src } directory of your package):
603603
604- <<lang =sh >>=
604+ <<lang =bash >>=
605605PKG_CPPFLAGS + = - I.. / inst / include /
606606@
607607
0 commit comments