From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Shu Subject: Re: Exporting output and graphics from R Date: Thu, 30 May 2013 21:15:44 +0800 Message-ID: <87txlklibj.fsf@news.tumashu-localhost.org> References: <86li6wvenc.fsf@somewhere.org> <87li6wzlab.fsf@krugs.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui2iy-00048z-Rl for emacs-orgmode@gnu.org; Thu, 30 May 2013 09:17:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ui2it-0005TZ-UQ for emacs-orgmode@gnu.org; Thu, 30 May 2013 09:17:00 -0400 Received: from mail-pb0-x233.google.com ([2607:f8b0:400e:c01::233]:54475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui2it-0005TR-MB for emacs-orgmode@gnu.org; Thu, 30 May 2013 09:16:55 -0400 Received: by mail-pb0-f51.google.com with SMTP id jt11so327962pbb.24 for ; Thu, 30 May 2013 06:16:54 -0700 (PDT) Received: from news.tumashu-localhost.org ([110.97.82.72]) by mx.google.com with ESMTPSA id pm7sm2960743pbb.31.2013.05.30.06.16.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 06:16:53 -0700 (PDT) Received: from feng by news.tumashu-localhost.org with local (Exim 4.80) (envelope-from ) id 1Ui2hk-00026N-K8 for emacs-orgmode@gnu.org; Thu, 30 May 2013 21:15:44 +0800 In-Reply-To: <87li6wzlab.fsf@krugs.de> (Rainer M. Krug's message of "Thu, 30 May 2013 14:47:56 +0200") 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: emacs-orgmode@gnu.org Rainer@krugs.de (Rainer M. Krug) writes: > "Sebastien Vauban" > 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]] > `---- > #+BEGIN_SRC R :results output :exports both pngname <- "testout.png" png(pngname) plot(1:10, 1:10) dev.off() x <- 1:10 paste("[[./", pngname, "]]",sep="") #+END_SRC > 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> > --