From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Problem with R source blocks Date: Thu, 11 Jun 2015 13:12:47 -1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3Bev-0008Jc-NI for emacs-orgmode@gnu.org; Thu, 11 Jun 2015 19:13:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3Bep-0000xi-Ix for emacs-orgmode@gnu.org; Thu, 11 Jun 2015 19:13:17 -0400 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:54052) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Z3Bep-0000tE-CG for emacs-orgmode@gnu.org; Thu, 11 Jun 2015 19:13:11 -0400 Received: from [72.253.144.27] (port=55003 helo=manifi) by box472.bluehost.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1Z3BeU-0005dY-TA for emacs-orgmode@gnu.org; Thu, 11 Jun 2015 17:12:51 -0600 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 Aloha all, Recently, some previously working R code (below) stopped working correctly. It is not possible to produce a graphic without :session. I get a red message in the pdf file "arguments imply differing numbers of rows: 86, 79". With :session, I first get one of two error messages in red in the pdf file, either "Results must be all atomic, or all data frames" or "subscript out of bounds". With the "subscript out of bounds" error, if I run the source code block again, I get the expected graphic. With the "Results must be all atomic ..." message, if I re-run the source code block several times, I see first an error "arguments imply differing numbers of rows: 67, 60", then on the next run "arguments imply differing numbers of rows: 86, 79" (like running outside a :session), then the expected graphic. Subsequent runs all produce the expected graphic. If I jump to the session, then print(g) works as expected, without any error messages. I haven't the faintest idea what might be happening, or how to debug. #+begin_src emacs-lisp (org-version) #+end_src #+results: : 8.3beta #+begin_src emacs-lisp (emacs-version) #+end_src #+results: : GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) : of 2015-04-18 on tennine-slave.macports.org All the best, Tom ,------------------------------------------------------------------------- | #+name: dated-interval-plot | #+header: :file ~/temp/test-plot.pdf | #+header: :var bcal = heiau-dates | #+header: :var base.font = 11 | #+header: :var theme = "bw" | #+header: :var xlabel = "Years After Polynesian Discovery" | #+header: :var ylabel = "Probability" | #+header: :var rows=4 | #+header: :var cols=4 | #+header: :var xmin=0 | #+header: :var xmax=1000 | #+header: :width 7 :height 5 | #+header: :results graphics | #+BEGIN_SRC R :session | library(ggplot2) | library(ggthemes) | bcal.df <- data.frame(cal=numeric(0),prob=numeric(0),label=character(0)) | for (i in seq(dim(bcal)[1])) | { | t <- read.csv(file=bcal[i,1]) | names(t) <- c("cal","prob") | t <- cbind(t,label=rep(bcal[i,2], dim(t)[1])) | bcal.df <- rbind(bcal.df,t) | } | switch(theme, | bw =, BW = theme_set(theme_bw(base_size=base.font)), | grey =, gray = theme_set(theme_grey(base_size=base.font)), | tufte = theme_set(theme_tufte(base_size=base.font)), | calc = theme_set(theme_calc(base_size=base.font)), | econ =, economist = theme_set(theme_economist(base_size=base.font)), | excel = theme_set(theme_excel(base_size=base.font)), | few = theme_set(theme_few(base_size=base.font)), | five = theme_set(theme_fivethirtyeight(base_size=base.font)), | google =, gdocs = theme_set(theme_gdocs(base_size=base.font)), | ## highchart =, hc = theme_set(theme_hc(base_size=base.font)), | inverted = theme_set(theme_igray(base_size=base.font)), | solarized = theme_set(theme_solarized(base_size=base.font)), | solarized2 = theme_set(theme_solarized_2(base_size=base.font)), | ## solid = theme_set(theme_solid(base_size=base.font)), | stata = theme_set(theme_stata(base_size=base.font,scheme="s2mono")), | wsj = theme_set(theme_wsj(base_size=base.font)), | theme_set(theme_bw(base_size=base.font))) | g <- ggplot(bcal.df, aes(x=cal, y=prob)) | g <- g + geom_bar(stat='identity') + xlab(xlabel) + xlim(xmin,xmax) | g <- g + ylab(ylabel) + facet_wrap(~ label, nrow=rows, ncol=cols) | print(g) | #+END_SRC `------------------------------------------------------------------------- -- T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com