emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* R code block on Worg
@ 2013-04-10  0:18 Nick Dokos
  2013-04-10  1:02 ` Jay Kerns
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2013-04-10  0:18 UTC (permalink / raw)
  To: emacs-orgmode

The example I used earlier came from

    http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

Here it is again for reference:

--8<---------------cut here---------------start------------->8---
#+name: r-with-ggplot2
#+begin_src R :results output graphics :var tbl=foo :file r/foo-output.png :width 400 :height 300
  library(ggplot2)
  res <- ggplot(tbl, aes(a_foo_var))
  res + geom_histogram(aes(y=..density..)) +
  geom_density(weight=2) + xlab("A foo variable")
#+end_src
--8<---------------cut here---------------end--------------->8---

Just to be clear, my R knowledge is less than \epsilon.
I was trying to get this to work and I had a few problems:

o It uses a table named "foo" as input, which does not appear on the
  page at all.  So I added a stupid table of my own. The only trouble is
  I'm not sure what the code does with it.

o It uses the ggplot2 library (and the earlier examples use the ascii
  library) which I didn't have on my system.  I was trying to find a
  package on Ubuntu to get these, but I couldn't. I finally stumbled
  across the R way of installing libraries:

  > install.packages("ggplot2")

  at the R prompt.

o Then R complained about a_foo_var:

  + Error in eval(expr, envir, enclos) : object 'a_foo_var' not found

  So I just added a dummy a_foo_var <- 3 into the block to get it going,
  but again, I have no idea what the code does with it.

o Finally, there is no graphic output on the page that I could compare
  with what I got and no explanatory description. I *could* go and learn
  some R and be a better person for it too, but I just wanted a little
  taste and this example was a bit too troublesome for me.

Could somebody knowledgeable in R fix the example and perhaps provide
some explanatory comments? Or provide suitable handholding?  Given the
latter, I'd be happy to make the changes necessary. Or perhaps this is
not the best example for that page and a simpler example could be given
instead?

Thoughts?

Thanks,
Nick





  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: R code block on Worg
  2013-04-10  0:18 R code block on Worg Nick Dokos
@ 2013-04-10  1:02 ` Jay Kerns
  2013-04-10  3:26   ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Kerns @ 2013-04-10  1:02 UTC (permalink / raw)
  To: ndokos; +Cc: emacs-orgmode

Dear Nick,

On Tue, Apr 9, 2013 at 8:18 PM, Nick Dokos <ndokos@gmail.com> wrote:
> The example I used earlier came from
>
>     http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

[snip]

I seem to have overlooked your earlier message - sorry about that.  As
far as doing R stuff with Org I am afraid that ob-doc-R is a bit
behind all of the many, many released changes of recent weeks.  Some
time back I updated an extended document (originally written by Erik
Iverson) to work with the new exporter.  You can find all of that
here:

https://github.com/gjkerns/org-mode-R-tutorial

I recommend working through the *.org file and looking at the *.pdf
and *.html files for comparison.  It goes through a whole bunch of
things, and there is a ggplot2 example, too.

I hope to eventually migrate that over to Worg but thought it best to
wait for Org-8.0's release.  Perhaps you may find something useful
there in the meantime.

I hope this helps,
-- 
Jay

P.S. If you find yourself walking further down the R path you might be
interested in IPSUR.  It is written in org so you'd feel right at
home.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: R code block on Worg
  2013-04-10  1:02 ` Jay Kerns
@ 2013-04-10  3:26   ` Nick Dokos
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2013-04-10  3:26 UTC (permalink / raw)
  To: Jay Kerns; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]

On Tue, Apr 9, 2013 at 9:02 PM, Jay Kerns <gjkernsysu@gmail.com> wrote:

> Dear Nick,
>
> On Tue, Apr 9, 2013 at 8:18 PM, Nick Dokos <ndokos@gmail.com> wrote:
> > The example I used earlier came from
> >
> >     http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
>
> [snip]
>
> I seem to have overlooked your earlier message - sorry about that.


I just happened to use this example (because I was working on it at the
time) for an unrelated question, that's all, so no worries.


>  As
> far as doing R stuff with Org I am afraid that ob-doc-R is a bit
> behind all of the many, many released changes of recent weeks.  Some
> time back I updated an extended document (originally written by Erik
> Iverson) to work with the new exporter.  You can find all of that
> here:
>
> https://github.com/gjkerns/org-mode-R-tutorial
>
> I recommend working through the *.org file and looking at the *.pdf
> and *.html files for comparison.  It goes through a whole bunch of
> things, and there is a ggplot2 example, too.
>
> I hope to eventually migrate that over to Worg but thought it best to
> wait for Org-8.0's release.  Perhaps you may find something useful
> there in the meantime.
>
> I hope this helps,
> --
> Jay
>
> P.S. If you find yourself walking further down the R path you might be
> interested in IPSUR.  It is written in org so you'd feel right at
> home.
>

Thanks for the pointers - I'll work through the examples. I tried to take a
look at your book, but Chrome was bent out of shape for some reason. I'll
try again later, but the first 10 seconds were very encouraging!

Thanks,
Nick

[-- Attachment #2: Type: text/html, Size: 3092 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-10  3:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10  0:18 R code block on Worg Nick Dokos
2013-04-10  1:02 ` Jay Kerns
2013-04-10  3:26   ` Nick Dokos

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).