From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: R code block on Worg Date: Tue, 09 Apr 2013 20:18:18 -0400 Message-ID: <25652.1365553098@pierrot.dokosmarshall.org> Reply-To: ndokos@gmail.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPikZ-0007fD-PT for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 20:18:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPikY-0003lF-I0 for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 20:18:55 -0400 Received: from vms173007pub.verizon.net ([206.46.173.7]:12895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPikY-0003jW-Bd for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 20:18:54 -0400 Received: from pierrot.dokosmarshall.org ([unknown] [108.7.96.134]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0ML0003REJIICZ90@vms173007.mailsrvcs.net> for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 19:18:34 -0500 (CDT) Received: from pierrot.dokosmarshall.org (localhost [127.0.0.1]) by pierrot.dokosmarshall.org (Postfix) with ESMTP id 8B1192D76 for ; Tue, 09 Apr 2013 20:18:18 -0400 (EDT) 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 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