From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joseph Cole Subject: Re: Org babel R Help Date: Sun, 21 Mar 2010 22:18:48 +1300 Message-ID: <20100321221848.100245krd2ozqirc@www.studentmail.otago.ac.nz> References: <20100319210128.15640tev1fryn3h4@www.studentmail.otago.ac.nz> <87mxy4wfi1.fsf@stats.ox.ac.uk> <5084fc611003210151x41850afcg36b275679ae76acb@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtHJD-0001Wg-Qr for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 05:18:59 -0400 Received: from [140.186.70.92] (port=49776 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtHJB-0001UV-UN for Emacs-orgmode@gnu.org; Sun, 21 Mar 2010 05:18:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtHJ9-00061J-Tm for Emacs-orgmode@gnu.org; Sun, 21 Mar 2010 05:18:57 -0400 Received: from mailhub2.otago.ac.nz ([139.80.64.247]:50565) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtHJ9-00060r-C5 for Emacs-orgmode@gnu.org; Sun, 21 Mar 2010 05:18:55 -0400 In-Reply-To: <5084fc611003210151x41850afcg36b275679ae76acb@mail.gmail.com> Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: davison@stats.ox.ac.uk, Emacs-orgmode@gnu.org > Joseph Cole writes: > >> I've been struggling with a few aspects of org babel R: >> >> 1) src_R surrounds output with =3D=3D. >> >> E.g. src_R{1+1} gives =3D2=3D >> >> I would expect it to just give 2. Because it surrounds the output with >> equals signs, this means you are unable to use the output in latex >> equations, general text or tables as it's ugly. > > Hi Joseph, > > If you use ':results raw', then the results will be inserted without the > surrounding '=3D'. You will need to pull the latest git head as I just > fixed a bug regarding that. So you could use > > src_R[:results raw]{1+1} > > but to make it less clumsy you could configure > org-babel-default-inline-header-args, e.g. > > (setq org-babel-default-inline-header-args > =A0 =A0 =A0(org-babel-merge-params org-babel-default-inline-header-args > '((:results . "raw")))) > > after which > > \begin{equation} > 1 + src_R{1+1} =3D 3 > \end{equation} > > exports to latex as > > \begin{equation} > 1 + 2 =3D 3 > \end{equation} > > As for the default behaviour, the =3D=3D declares that the contents should > be formatted fixed-width on export. Normally in latex export that > results in \texttt{}, but I see that inside a begin_equation the =3D=3D > remain. I wonder whether that could be argued to be an org-mode latex > exporter bug? Thanks for the help, I'm pulling down the head to test. It certainly would make more sense to embed raw automatically within =20 equations. > >> >> Where should I start looking to fix this? I'm a lisp novice but happy >> to learn. > > org-babel-exp.el Thanks. The code makes sense. >> 2) Width/Height exports for R graphics output. Do they work? >> >> I've tried a lot of combinations of :width and :height as exports, and >> they don't seem to work at all. I've tried small numbers (1-10), large >> numbers (100-2000) and numbers prefixed by "cm" with no luck. > > Hmm, I'm not seeing a problem here. It works for me with both png and > pdf output. E.g. > > #+begin_src R :file z.pdf :width 20 :height 40 :exports both > plot(1:10) > #+end_src > What image format (i.e. R graphics device) are you using? =A0Can you post > an example block that is not working? The values for :width and :height > will be passed straight on to the graphics device, so their meaning > depends on which graphics device is being used in R. I'm trying the code you posted with the latest org-mode from ubuntu =20 and getting nothing in my results if I use png. If I use pdf, I get a =20 really tiny chart which is incomprehensible. Width and height seem to =20 work randomly, as using 20:40 work with pdf (although tiny), but =20 100,100 do not work at all. It only works correctly if I use the #+attr_latex: width=3DXcm and omit =20 the width and height. I'm using ubuntu jaunty fully up to date, org mode from the website =20 (6.34c), R 2.92, and the stock standard latex install for ubuntu. > >> >> I know I can use #+attr_latex: width=3D15cm. >> >> 3) R-graphics quality >> >> I can't seem to find any examples of how to set the R graphics output >> quality, and nothing I try seems to alter the result (using :quality). > > I'm not sure what you mean by "R graphics output quality". The section > "Graphical output" in > > http://orgmode.org/worg/org-contrib/babel/languages/org-babel-doc-R.php > > describes how to pass arguments to the R graphics devices. In addition > to the ones that org-babel knows about like :width, you can pass > arbitrary extra arguments to the R device using :R-dev-args. > >> >> Are there any publication quality r-graphics examples I could take a >> look at, as I've been unable to find any on google. > > You mean using org-babel or just using R? Using babel. For some reason my R graphics embedded within my pdf's =20 don't seem to be as "nice" as viewing them from within R, i.e. =20 slightly fuzzy edges. It's like the antialiasing has failed or =20 something. The text labels on the axes are definitely not up to latex =20 standard. Best regards, Joe