emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Joseph Cole <coljo582@student.otago.ac.nz>
Cc: emacs-orgmode@gnu.org
Subject: Re: Org babel R Help
Date: Fri, 19 Mar 2010 10:30:30 -0400	[thread overview]
Message-ID: <87mxy4wfi1.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <20100319210128.15640tev1fryn3h4@www.studentmail.otago.ac.nz> (Joseph Cole's message of "Fri, 19 Mar 2010 21:01:28 +1300")

Joseph Cole <coljo582@student.otago.ac.nz> writes:

> I've been struggling with a few aspects of org babel R:
>
> 1) src_R surrounds output with ==.
>
> E.g. src_R{1+1} gives =2=
>
> 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 '='. 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
      (org-babel-merge-params org-babel-default-inline-header-args '((:results . "raw"))))

after which 

\begin{equation}
1 + src_R{1+1} = 3
\end{equation}

exports to latex as

\begin{equation}
1 + 2 = 3
\end{equation}

As for the default behaviour, the == 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 ==
remain. I wonder whether that could be argued to be an org-mode latex
exporter bug?

>
> Where should I start looking to fix this? I'm a lisp novice but happy
> to learn.

org-babel-exp.el

>
> 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?  Can 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 know I can use #+attr_latex: width=15cm.
>
> 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?

Hope that helps.

Dan


>
>
>
> _______________________________________________
> 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

  reply	other threads:[~2010-03-19 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19  8:01 Org babel R Help Joseph Cole
2010-03-19 14:30 ` Dan Davison [this message]
     [not found]   ` <5084fc611003210151x41850afcg36b275679ae76acb@mail.gmail.com>
2010-03-21  9:18     ` Joseph Cole
2010-03-21  9:53       ` Graham Smith
2010-03-21 14:19         ` Dan Davison
2010-03-21 17:45           ` Graham Smith

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=87mxy4wfi1.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=coljo582@student.otago.ac.nz \
    --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).