Skip to content

Commit a44c4a7

Browse files
committed
Embedded R code chunks in sourceCpp can now be disabled
1 parent 08e6c89 commit a44c4a7

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2014-02-01 JJ Allaire <[email protected]>
2+
3+
* R/Attributes.R: Embedded R code chunks in sourceCpp can
4+
now be disabled
5+
16
2014-01-31 Dirk Eddelbuettel <[email protected]>
27

38
* vignettes/Rcpp-FAQ.Rnw: Render code with background boxen

R/Attributes.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
sourceCpp <- function(file = "",
2121
code = NULL,
2222
env = globalenv(),
23+
embeddedR = TRUE,
2324
rebuild = FALSE,
2425
showOutput = verbose,
2526
verbose = getOption("verbose")) {
@@ -169,7 +170,7 @@ sourceCpp <- function(file = "",
169170
}
170171

171172
# source the embeddedR
172-
if (length(context$embeddedR) > 0) {
173+
if (embeddedR && (length(context$embeddedR) > 0)) {
173174
srcConn <- textConnection(context$embeddedR)
174175
setwd(rWorkingDir) # will be reset by previous on.exit handler
175176
source(file=srcConn, echo=TRUE)

inst/NEWS.Rd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
\itemize{
3434
\item Embedded R code chunks in sourceCpp are now executed within
3535
the working directory of the C++ source file.
36+
\item Embedded R code chunks in sourceCpp can now be disabled.
3637
}
3738
\item Changes in Rcpp documentation:
3839
\itemize{

man/sourceCpp.Rd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ and RCPP_MODULE declarations. A shared library is then built and its exported fu
99
}
1010
\usage{
1111
sourceCpp(file = "", code = NULL, env = globalenv(),
12-
rebuild = FALSE, showOutput = verbose,
13-
verbose = getOption("verbose"))
12+
embeddedR = TRUE, rebuild = FALSE,
13+
showOutput = verbose, verbose = getOption("verbose"))
1414
}
1515
\arguments{
1616
\item{file}{
@@ -21,6 +21,9 @@ sourceCpp(file = "", code = NULL, env = globalenv(),
2121
}
2222
\item{env}{
2323
Environment where the R functions and modules should be made available.
24+
}
25+
\item{embeddedR}{
26+
\code{TRUE} to run embedded R code chunks.
2427
}
2528
\item{rebuild}{
2629
Force a rebuild of the shared library.

0 commit comments

Comments
 (0)