summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer M. Krug <R.M.Krug@gmail.com>2014-10-06 13:48:49 +0200
committerAaron Ecay <aaronecay@gmail.com>2014-10-10 00:16:31 -0400
commit780db69cdf2f805d386f682c304aee77d78e15ca (patch)
treea7a0ed88242efc9aef7776ceade023dd29392cc6
parentc6c1a05894e6fb1698d1a12bb2dc6a47874169f6 (diff)
downloadorg-mode-780db69cdf2f805d386f682c304aee77d78e15ca.tar.gz
ob-R.el: Add package name to read.table call
* lisp/ob-R.el: (ob-R-transfer-variable-table-with-header) (ob-R-transfer-variable-table-without-header): Add package name to call of R function `read.table'. Thus, it now reads `utils::read.table'. This clarifies the call as well as avoids "could not find function" error in R with the devtools package. See <https://github.com/hadley/devtools/issues/336#issuecomment-23517837>.
-rw-r--r--lisp/ob-R.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index ea33031..4584173 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -96,12 +96,15 @@ this variable.")
(when (and session (string-match "^\\*\\(.+?\\)\\*$" session))
(save-match-data (org-babel-R-initiate-session session nil)))))
+;; The usage of utils::read.table() ensures that the command
+;; read.table() can be found even in circumstances when the utils
+;; package is not in the search path from R.
(defconst ob-R-transfer-variable-table-with-header
"%s <- local({
con <- textConnection(
%S
)
- res <- read.table(
+ res <- utils::read.table(
con,
header = %s,
row.names = %s,
@@ -112,6 +115,7 @@ this variable.")
res
})"
"R code used to transfer a table defined as a variable from org to R.
+
This function is used when the table contains a header.")
(defconst ob-R-transfer-variable-table-without-header
@@ -119,7 +123,7 @@ This function is used when the table contains a header.")
con <- textConnection(
%S
)
- res <- read.table(
+ res <- utils::read.table(
con,
header = %s,
row.names = %s,
@@ -132,6 +136,7 @@ This function is used when the table contains a header.")
res
})"
"R code used to transfer a table defined as a variable from org to R.
+
This function is used when the table does not contain a header.")
(defun org-babel-expand-body:R (body params &optional graphics-file)