You are not logged in.

#1 2014-04-14 22:02:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

[SOLVED] Sweave from R 3.1.0 fails to produce figures

[extra]/r was recently updates from 3.0.3-1 to 3.1.0-1.  With this update I lost the ability to compile Sweave documents.  I was only able to trace it to the following command *not* producing the figure image files even though no errors are generated:

R CMD Sweave document.Rnw

Downgrading to 3.0.3-1 resolves the issue.

Here is a minimal Sweave document that works with 3.0.3-1 but fails with 3.1.0-1:

\documentclass{article}

\SweaveOpts{prefix=FALSE}

\begin{document}

<<stats0,echo=FALSE>>=
a = 1
@

<<fig1,fig=TRUE,echo=FALSE>>=
plot(a)
@

\end{document}

I'm not sure what next steps to take in investigating, so any input would be appreciated.  As a first step I'd like to know if other Sweave users can replicate this issue or if mine is an isolated case.

Last edited by Trilby (2014-06-05 01:31:49)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#2 2014-04-15 13:53:22

a821
Member
Registered: 2012-10-31
Posts: 381

Re: [SOLVED] Sweave from R 3.1.0 fails to produce figures

I can replicate the issue with a custom R-3.1 compilation. This works though

$ Rscript -e 'Sweave("a.Rnw")'
Writing to file a.tex
Processing code chunks with options ...
 1 : keep.source term verbatim (label = stats0, a.Rnw:7)
 2 : keep.source term verbatim pdf  (label = fig1, a.Rnw:11)

You can now run (pdf)latex on ‘a.tex’

(a.Rnw is your minimal example). here they report the same problem so I don't think it's arch specific. I quote "Basically  'R CMD Sweave' is partly broken in R 3.1.0.". I didn't read the whole thread though...

Offline

#3 2014-04-15 15:13:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [SOLVED] Sweave from R 3.1.0 fails to produce figures

Thanks!  Perfect answer.  I always struggle googling for things related to r.  It's not exactly a unique letter.

I hope this is a bug that will be fixed, but for now the Rscript approach works perfectly well.

In case it helps other users, here's that command in the context of a before and after vim keybinding to generate, view, and cleanup regeneratable files:

"Sweave
"au BufNewFile,BufRead *.Rnw nmap <F5> ;w<CR>;silent !R CMD Sweave "%"; latexmk -quiet -pv "%:r"; latexmk -c "%:r"; rm "%:r".tex<CR><CR>;redraw!<CR>
au BufNewFile,BufRead *.Rnw nmap <F5> ;w<CR>;silent !Rscript -e 'Sweave("%")'; latexmk -quiet -pv "%:r"; latexmk -c "%:r"; rm "%:r".tex<CR><CR>;redraw!<CR>

I've opened a bug report on R's bug tracker.

Last edited by Trilby (2014-04-15 15:41:07)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2014-06-04 18:49:10

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: [SOLVED] Sweave from R 3.1.0 fails to produce figures

should be fixed in 3.1.0-2

Offline

#5 2014-06-05 01:31:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [SOLVED] Sweave from R 3.1.0 fails to produce figures

Thanks for following up on this pressh - I realize in the report I filed on our bugtracker (after an upstream patch was made available) that the upstream patch wasn't added to the upstream "vanilla" source, but only to a "r-patched" branch.  I'm glad too see this incorporated into our package and just confirmed it is working as intended.

EDIT: changed thread from [known bug w/ workaround] to [solved]


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2014-06-05 11:22:13

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: [SOLVED] Sweave from R 3.1.0 fails to produce figures

Trilby wrote:

I always struggle googling for things related to r.

It probably wouldn't have helped in this case, but FYI:

http://www.rseek.org

Offline

Board footer

Powered by FluxBB