From: Dan Davison <davison@stats.ox.ac.uk>
To: Erik Iverson <eriki@ccbr.umn.edu>
Cc: David Hajage <dhajage@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Babel: interweaving code and results?
Date: Wed, 18 Aug 2010 10:49:06 -0400 [thread overview]
Message-ID: <87k4no0ye5.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <4C6BDCE3.9010903@ccbr.umn.edu> (Erik Iverson's message of "Wed, 18 Aug 2010 08:15:15 -0500")
Erik Iverson <eriki@ccbr.umn.edu> writes:
> David,
>
> On 08/18/2010 08:09 AM, David Hajage wrote:
>> Hello,
>>
>> I am back with babel and R with a new question. Is it possible to
>> interweave each line of code with its results?
>>
>> An example to explain what I mean:
>>
>> #+SRCNAME: foo
>> #+BEGIN_SRC R :results output :exports results
>> 2+2
>> 3+3
>> #+END_SRC
>>
>> #+results: foo
>> : [1] 4
>> : [1] 6
>>
>> When exporting (to html or latex), I would like to print what is going
>> on in the R console. So, I would like:
>>
>> #+results: foo
>> :> 2+2
>> : [1] 4
>> :> 3+3
>> : [1] 6
>>
>> Is it possible, or eventualy planned for the futur?
Hi David,
This is actually quite easy, although I don't think anyone's flagged
this possibility up: just do
(setq org-babel-R-command "R --silent --no-save")
(Our default is --slave --no-save) There's an example session below. By
the way, can I just check that you're aware of the ':exports both'
option? That's the canonical Org way of exporting both code and
results. It doesn't interleave them: it's more geared towards 'one code
block <-> one result'. But I understand that there may be situations
where interleaved is desired.
Erik -- You might well be right that we should add an :interleave option
to modify :results output like this.
--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
org-babel-R-command
#+end_src
#+results:
: R --slave --no-save
#+begin_src R :results output
2+2
3+3
#+end_src
#+results:
: [1] 4
: [1] 6
#+begin_src emacs-lisp
(setq org-babel-R-command "R --silent --no-save")
#+end_src
#+results:
: R --silent --no-save
#+begin_src R :results output
2+2
3+3
#+end_src
#+results:
: > 2+2
: [1] 4
: > 3+3
: [1] 6
: >
--8<---------------cut here---------------end--------------->8---
[Maybe we can battle that trailing prompt character]
Dan
>
> I think I put together a :results weave option a couple
> months ago that did just this.
>
> I'll have to look if I can find it, I'll
> let you know.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-08-18 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 13:09 Babel: interweaving code and results? David Hajage
2010-08-18 13:15 ` Erik Iverson
2010-08-18 13:28 ` David Hajage
2010-08-18 14:49 ` Dan Davison [this message]
2010-08-18 14:57 ` David Hajage
2010-08-18 16:07 ` Dan Davison
2010-08-18 15:03 ` Erik Iverson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k4no0ye5.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=dhajage@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=eriki@ccbr.umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).