From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: Babel/R issue: 'x' must be atomic Date: Thu, 23 Aug 2012 18:59:08 -0500 Message-ID: References: <2012-08-24T01-13-00@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4hIt-0000W6-9i for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 19:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4hIr-0008Fv-N0 for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 19:59:11 -0400 Received: from mail-vb0-f41.google.com ([209.85.212.41]:41706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4hIr-0008Fq-Ic for emacs-orgmode@gnu.org; Thu, 23 Aug 2012 19:59:09 -0400 Received: by vbkv13 with SMTP id v13so1693573vbk.0 for ; Thu, 23 Aug 2012 16:59:08 -0700 (PDT) In-Reply-To: <2012-08-24T01-13-00@devnull.Karl-Voit.at> 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: news1142@karl-voit.at Cc: emacs-orgmode@gnu.org On Thu, Aug 23, 2012 at 6:23 PM, Karl Voit wrote: > Hi! > > Generating two separate boxplots for a given set of data is no problem. B= ut > when I combine them into one single diagram (with two boxplots), I get: > > Error in sort.int(x, na.last =3D na.last, decreasing =3D decreasing, ...)= : > 'x' must be atomic > Calls: ... boxplot.stats -> -> sort -> sort.defau= lt -> sort.int > Execution halted > > > You can get the minimal example Org-mode on http://paste.grml.org/1036/ > > When I replace the line > boxplot(list(folders, tags), > with > boxplot(list(mfolders, mtags), > it works, though :-O > > mfolders and mtags are lists in R and not imported via =C2=BB:var=C2=AB. = Therefore I > guess this is an Org-mode/babel issue and not an R issue. What is my erro= r? > > Any help would be very cool! Org must convert tables to data.frames, which is a problem for boxplot(): ,----- ?boxplot ----- | x: for specifying data from which the boxplots are to be | produced. Either a numeric vector, or a single list | containing such vectors. `----- So, you need to pass a list of /vectors/, not a data.frame. Here's what's going on: #+begin_src R > str(folders) 'data.frame': 10 obs. of 1 variable: $ V1: int 14 14 15 18 18 19 20 21 22 23 > str(mfolders) num [1:17] 4.3 3.72 5.1 4.03 5.7 ... > str(tags) 'data.frame': 15 obs. of 1 variable: $ V1: int 1 3 3 3 3 3 4 4 4 4 ... > str(mtags) num [1:15] 3.95 4.25 5.22 6.2 5.27 ... #+end_src So... folders is a data.frame with one numeric vector, V1. Same for tags. For mfolder and mtags, you created a vector, not a data.frame. Try this to pass the vectors from each data.frame: #+begin_src R boxplot(list(folders$V1, tags$V1), names=3Dc("one", "two"), xlab=3D"boxplot12", ylab=3D"numbers", pars =3D list(boxwex =3D 0.3, staplewex =3D 0.5, boxfill=3D"lightblue")) #+end_src That should work! John > > > PS: Org-mode version from git from yesterday > > -- > Karl Voit > >