Skip to content

Embedded R code chunks in sourceCpp can now be disabled #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-02-01 JJ Allaire <jj@rstudio.org>

* R/Attributes.R: Embedded R code chunks in sourceCpp can
now be disabled

2014-01-31 Dirk Eddelbuettel <edd@debian.org>

* vignettes/Rcpp-FAQ.Rnw: Render code with background boxen
Expand Down
3 changes: 2 additions & 1 deletion R/Attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
sourceCpp <- function(file = "",
code = NULL,
env = globalenv(),
embeddedR = TRUE,
rebuild = FALSE,
showOutput = verbose,
verbose = getOption("verbose")) {
Expand Down Expand Up @@ -169,7 +170,7 @@ sourceCpp <- function(file = "",
}

# source the embeddedR
if (length(context$embeddedR) > 0) {
if (embeddedR && (length(context$embeddedR) > 0)) {
srcConn <- textConnection(context$embeddedR)
setwd(rWorkingDir) # will be reset by previous on.exit handler
source(file=srcConn, echo=TRUE)
Expand Down
1 change: 1 addition & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
\itemize{
\item Embedded R code chunks in sourceCpp are now executed within
the working directory of the C++ source file.
\item Embedded R code chunks in sourceCpp can now be disabled.
}
\item Changes in Rcpp documentation:
\itemize{
Expand Down
7 changes: 5 additions & 2 deletions man/sourceCpp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ and RCPP_MODULE declarations. A shared library is then built and its exported fu
}
\usage{
sourceCpp(file = "", code = NULL, env = globalenv(),
rebuild = FALSE, showOutput = verbose,
verbose = getOption("verbose"))
embeddedR = TRUE, rebuild = FALSE,
showOutput = verbose, verbose = getOption("verbose"))
}
\arguments{
\item{file}{
Expand All @@ -21,6 +21,9 @@ sourceCpp(file = "", code = NULL, env = globalenv(),
}
\item{env}{
Environment where the R functions and modules should be made available.
}
\item{embeddedR}{
\code{TRUE} to run embedded R code chunks.
}
\item{rebuild}{
Force a rebuild of the shared library.
Expand Down