From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: [Babel][R] Inclusion of multi-line named code blocks in R code Date: Wed, 18 Sep 2013 12:27:35 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMQEE-0002Xr-Mw for emacs-orgmode@gnu.org; Wed, 18 Sep 2013 18:28:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMQE7-0002k1-LW for emacs-orgmode@gnu.org; Wed, 18 Sep 2013 18:28:10 -0400 Received: from oproxy1-pub.mail.unifiedlayer.com ([66.147.249.253]:37389) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1VMQE7-0002je-FW for emacs-orgmode@gnu.org; Wed, 18 Sep 2013 18:28:03 -0400 In-Reply-To: (Alexander Vorobiev's message of "Wed, 18 Sep 2013 16:51:26 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alexander Vorobiev Cc: emacs-orgmode Aloha Alex, My work flow in this situation evaluates the SQL to create an Org-mode table, which serves as input to the R source code block. For me, seeing the SQL output in a table is a sanity check. hth, Tom Alexander Vorobiev writes: > I have R code which submits SQL statements to a database server. Since the > SQL is rather complex, I want to put it into a separate code block in order > to have proper formatting, syntax highlighting, etc: > > #+name: long-sql > #+begin_src sql > select * > from many, tables > where > complex_condition1 = 1, > complex_condition2 = 2 > #+end_src > > * Load the data to R session > #+begin_src R :session *R* :noweb yes > result <- submit_query('<>') > #+end_src > > Unfortunately, the R block doesn't work. When I open the file generated by > Babel, I see this: > > result <- submit_query('select * > result <- submit_query('from many, tables > etc > > instead of the one R submit_query call with my SQL statement as an > argument. Is there anything I can do to achieve that? > > Thanks > Alex > I have R code which submits SQL statements to a database server. Since > the SQL is rather complex, I want to put it into a separate code block > in order to have proper formatting, syntax highlighting, etc: > > #+name: long-sql > #+begin_src sql > select * > from many, tables > where > complex_condition1 = 1, > complex_condition2 = 2 > #+end_src > > * Load the data to R session > #+begin_src R :session *R* :noweb yes > result <- submit_query('<>') > #+end_src > > Unfortunately, the R block doesn't work. When I open the file > generated by Babel, I see this: > > result <- submit_query('select * > result <- submit_query('from many, tables > etc > > instead of the one R submit_query call with my SQL statement as an > argument. Is there anything I can do to achieve that? > > Thanks > Alex > > -- Thomas S. Dye http://www.tsdye.com