emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: emacs-orgmode@gnu.org
Subject: Problem with R source blocks
Date: Thu, 11 Jun 2015 13:12:47 -1000	[thread overview]
Message-ID: <m27fr9zvo0.fsf@tsdye.com> (raw)

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

             reply	other threads:[~2015-06-11 23:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 23:12 Thomas S. Dye [this message]
2015-06-12 18:50 ` Problem with R source blocks Charles C. Berry
2015-06-12 21:55   ` Thomas S. Dye
2015-06-12 22:33     ` Charles C. Berry
2015-06-12 23:54       ` Thomas S. Dye
2015-06-13  0:26         ` Thomas S. Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m27fr9zvo0.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).