Cryptic error message in emacs org-mode following attempted export of file containing image-generating block of R code

StackOverflow https://stackoverflow.com/questions/9147436

Question

I have an R code block that generates an image (see below). Executing the code is no problem (i.e., C-c C-c from within the block generates an image temp.png as expected). However, on export to PDF via LaTeX, there is an error message:

org-babel-sha1-hash: Wrong number of arguments: called-interactively-p, 1

The only other reference to this error (sans the bit about sha1) is from here, http://xahlee.org/emacs/elisp_byte_compile_problem.html in a very diffirent context.

The code block closely follows the example from this previous question Embedding R plots in Latex via org-mode Here's the code:

#+NAME: optimal_applications 
#+BEGIN_SRC R  :results graphics :file temp.png :exports both  
require(ggplot2) 
c <- c(.01, .05, .10) 
df <- data.frame(q =
  rep((0:100)/100, length(c)), 
c = c(sapply(c, function(x) rep(x,  101))) )

df$s.star <- with(df, log(-c/log(1-q))/log(1-q))
df$s.star[df$s.star < 0] <- 0

g <- ggplot(df, aes(x = q, y = s.star, colour=factor(c))) + geom_line(aes(group=factor(c))) +
    xlab("Probability that an application is successful") +
    ylab("Optimal number of applications to send")
print(g) 
#+END_SRC   

Update: org-mode & emacs version

Org-mode version 7.8.03 (release_7.8.03.267.g1c8eb)
GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4) of 2011-04-04 on crested, modified by Debian
Was it helpful?

Solution

After learning that G.Jay Kerns couldn't reproduce with a newer version of Emacs, I upgraded to Emacs 24.0.91.1 and the problem was resolved. FWIW, https://superuser.com/questions/296013/how-do-i-upgrade-emacs-to-the-current-version-on-ubuntu has short tutorial on how to build Emacs from the repository that proved useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top