On Thu, Aug 23, 2012 at 6:23 PM, Karl Voit <devn...@karl-voit.at> wrote: > Hi! > > Generating two separate boxplots for a given set of data is no problem. But > when I combine them into one single diagram (with two boxplots), I get: > > Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : > 'x' must be atomic > Calls: <Anonymous> ... boxplot.stats -> <Anonymous> -> sort -> sort.default > -> 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 »:var«. Therefore I > guess this is an Org-mode/babel issue and not an R issue. What is my error? > > 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=c("one", "two"), xlab="boxplot12", ylab="numbers", pars = list(boxwex = 0.3, staplewex = 0.5, boxfill="lightblue")) #+end_src That should work! John > > > PS: Org-mode version from git from yesterday > > -- > Karl Voit > >