From b3ddb3bf0bb327187acdd898a6173d22ceefe5fb Mon Sep 17 00:00:00 2001 From: "Rainer M. Krug" Date: Mon, 7 Apr 2014 10:52:00 +0200 Subject: [PATCH 6/8] Make R code look nicer in R * lisp/ob-R.el (org-babel-expand-body:R): Added Space to the R code blocks to make them easier identifiable in R. --- lisp/ob-R.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 3534580..5edbed9 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -105,12 +105,12 @@ this variable.") (list (cdr (assoc :prologue params)))) '("######################################################################") '("## Beginning org variable transfer") - '("try(detach(.org_variables_), silent=TRUE)") - '(".org_variables_ <- new.env()") + '(" try(detach(.org_variables_), silent=TRUE)") + '(" .org_variables_ <- new.env()") (org-babel-variable-assignments:R params) - '("lockEnvironment(.org_variables_)") - '("attach(.org_variables_)") - '("save(.org_variables_, file='org_variables.RData')") + '(" lockEnvironment(.org_variables_)") + '(" attach(.org_variables_)") + '(" save(.org_variables_, file='org_variables.RData')") '("## end org variable transfer") '("######################################################################") (list body) @@ -212,9 +212,9 @@ This function is called by `org-babel-execute-src-block'." "TRUE" "FALSE")) (row-names (if rownames-p "1" "NULL"))) (if (= max min) - (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names name) - (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE, fill=TRUE, col.names = paste(\"V\", seq_len(%d), sep =\"\") ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names max name)))) - (format "assign('%s', %s, envir = .org_variables_); lockBinding('%s', .org_variables_)" name (org-babel-R-quote-tsv-field value) name))) + (format " assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names name) + (format " assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE, fill=TRUE, col.names = paste(\"V\", seq_len(%d), sep =\"\") ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names max name)))) + (format " assign('%s', %s, envir = .org_variables_); lockBinding('%s', .org_variables_)" name (org-babel-R-quote-tsv-field value) name))) (defvar ess-ask-for-ess-directory) ; dynamically scoped (defun org-babel-R-initiate-session (session params) -- 1.8.5.2 (Apple Git-48)