emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer@krugs.de (Rainer M. Krug)
To: emacs-orgmode@gnu.org
Subject: Re: Exporting output and graphics from R
Date: Thu, 30 May 2013 14:47:56 +0200	[thread overview]
Message-ID: <87li6wzlab.fsf@krugs.de> (raw)
In-Reply-To: 86li6wvenc.fsf@somewhere.org

"Sebastien Vauban" <sva-news@mygooglest.com>
writes:

> Hi SabreWolfy,
>
> SabreWolfy wrote:
>> When the following code is evaluated or exported, only the link to
>> "testout.png" appears in the RESULTS section.
>>
>> #+BEGIN_SRC R :results output graphics :file testout.png :exports both
>> plot(1:10, 1:10)
>> x <- 1:10
>> library(ascii)
>> options(asciiType = "org")
>> ascii(x)
>> #+END_SRC
>
> Removing `output' here should solve the above point.
>
>> When this code is evaluated, the value of "x" appears in the RESULTS:
>>
>> #+BEGIN_SRC R :results output :exports both
>> x <- 1:10
>> library(ascii)
>> options(asciiType = "org")
>> ascii(x)
>> #+END_SRC
>>
>> How can I get the first example to output both graphics and ascii output?
>
> AFAICT, you can't have both at the same time. Do you have a real use case for
> this?

Not directly, But I used the following approach to include pdf as well
as jpeg ion a document.

You simply have to create your graph in R and then include a link in org
manually:

,----
| #+BEGIN_SRC R :results output :exports both
| png("testout.png")
| plot(1:10, 1:10)
| dev.off()
| x <- 1:10
| library(ascii)
| options(asciiType = "org")
| ascii(x)          
| #+END_SRC
| 
| 
| [[./testout.png]]
`----

you will get the code, result (output) and the graph (tested on export
to pdf).

Cheers,

Rainer

>
> If really needed, you can define your code once, wrap it with some value for
> the ":results" header, and "copy" it somewhere else via Noweb's facility,
> where it can be evaluated under other values for the ":results" header.
>
>> I'm using Org 7.9.2.
>
> Try upgrading now to Org 8 so that you fiddle only once with the export
> variables -- which changed, even if similar, between Org 7.9 and Org 8.
>
> Best regards,
>   Seb
<#secure method=pgpmime mode=sign>

-- 
Rainer M. Krug

  reply	other threads:[~2013-05-30 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 12:07 Exporting output and graphics from R SabreWolfy
2013-05-30 12:24 ` Sebastien Vauban
2013-05-30 12:47   ` Rainer M. Krug [this message]
2013-05-30 13:15     ` Feng Shu
2013-05-30 13:37       ` Rainer M. Krug
2013-05-31 12:15       ` SabreWolfy
2013-05-31 12:13   ` SabreWolfy
2013-05-31 12:25     ` Sebastien Vauban

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=87li6wzlab.fsf@krugs.de \
    --to=rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /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).