emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Error Embedding SQL Source from code block into R Source of Anot


From: Charles Berry
Subject: Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Date: Tue, 30 Sep 2014 15:08:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Brown <brown <at> fastmail.fm> writes:

> 
> Dear List:
> 
> It is possible to embed SQL code as a string to be evaluated in R. I am
> interested in formatting the SQL code in its own source code block, with
> its own syntax highlighting and editing mode (C-c ').
> 
> The first time I run the code, I am prompted for R starting directory,
> but I get an error:
> 
> ---
> load ESSR: + + + Error: unexpected string constant in:
> source('~/.emacs.d/elpa/ess-20140913.1153/etc/ESSR/R/.load.R',
> local=TRUE) #define load.ESSR
> load.ESSR('"
> ---
> 
> and the console locks.  I can C-g to get out of it, and then
> re-evaluate, and the code prints what I expect -- the text of the SQL
> command.


[rest deleted]

Hmmm. Maybe the bug that was fixed by commit

 0fd29a5ee7d14c3695b22998196373b9a3637413

about two weeks back? Make sure ob-R.el is up to date and compiled (or
that ob-R.elc is deleted).


Anyway, your code works as expected for me - first time.

---

FWIW, I prefer to use :var headers to import strings, but it takes some
setup:


--8<---------------cut here---------------start------------->8---

#+BEGIN_SRC emacs-lisp
  (defun grab-src (name)
    (save-excursion
      (org-babel-goto-named-src-block name)
      (nth 1 (org-babel-get-src-block-info 'light))))
#+END_SRC

#+BEGIN_SRC R :var y=(grab-src "sqlsource") :results output :exports both
  y
#+END_SRC

#+RESULTS:
: [1] "select \n  * \nfrom \n  t \nlimit \n  10"

--8<---------------cut here---------------end--------------->8---



HTH,

Chuck




reply via email to

[Prev in Thread] Current Thread [Next in Thread]