Aloha Rainer, Rainer M Krug <r.m.k...@gmail.com> writes:
>>> After eaa3a761dae, I get an error and an empty output file. >> >> That commit introduced a tryCatch() wrapper for graphics results. >> >> You probably know that ggplot (or ggplot2) relies on printing of >> objects to produce graphics (see R-FAQ 7.22). >> >> tryCatch(expr,...) evaluates expr and returns its value, which is >> `rm(g)' in your case. But `rm(g)' is not autoprinted, and you get an >> empty file. > > I am not in front of my computer but there must be more, as even > before the commit there should have been empty file for exactly the > same reason. Also, the error is strange. Could you send a small > reproducable example, so that we can see which error you get? Because > if you get an error and an empty file, an error must be in the > tryCatcb block. I'm picking up a project that I last worked on in 2013. I was under the impression that the source code blocks were working at that time, but I guess it is possible that I added the rm() statements after the code blocks were working and didn't realize that the addition broke them. I haven't looked too deeply into the problem, but just assumed that the session expressed in the source code block behaved as if it were entered at the R prompt. In the R session, I see this, which I initially thought was an error: > png(filename="r/buck-shoulder-hist.png",width=400,height=300); tryCatch({ b <- ggplot(x, aes(x=((thickness_shoulder * 100) / mapply(max, width_shoulder_front, width_shoulder_back)))) b + geom_histogram(aes(y=..density..)) + geom_density(weight=2) + xlab("Buck's Shoulder Index") + facet_wrap(~ turner) rm(b) },error=function(e){plot(x=-1:1, y=-1:1, type='n', xlab='', ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, col='red'); paste('ERROR', e$message, sep=' : ')}); dev.off() 'org_babel_R_eoe' + . + null device 1 hth, Tom -- Thomas S. Dye http://www.tsdye.com