Re: [R] Debugging Rmarkdown

2019-04-23 Thread Patrick Connolly
knitr::purl -- thats a great tip! As soon as got hold of a reqular .R script, I spotted the reason why my Fmd file wouldn't knit in a matter of seconds. Thank you Jeff. Thanks also to all the other suggestions. On Fri, 19-Apr-2019 at 02:44PM -0700, Jeff Newmiller wrote: |> I just run each ch

Re: [R] Debugging Rmarkdown

2019-04-19 Thread William Dunlap via R-help
You can set the error handler to save the current state of R in a file, "last.dump.rda" in the current working directory, when an error occurs with options(error=expression(dump.frames(to.file=TRUE, include.GlobalEnv=TRUE))) In another R session you can look at what it saved with load("last.d

Re: [R] Debugging Rmarkdown

2019-04-19 Thread Jeff Newmiller
Chunks are not isolated... they are executed in sequence in the same environment, starting with a fresh environment unrelated to whatever is present when you invoke render(). On April 19, 2019 3:00:33 PM PDT, Patrick Connolly wrote: >There are options to set echo and messages but AFAIK, the te

Re: [R] Debugging Rmarkdown

2019-04-19 Thread Patrick Connolly
There are options to set echo and messages but AFAIK, the text appears in the resultant file, but if the script fails, there's no file to inspect. On 20/04/19 9:50 AM, Bert Gunter wrote: > This might be offbase, but do you need to set options to cache the > results in the original code chunks to

Re: [R] Debugging Rmarkdown

2019-04-19 Thread Bert Gunter
This might be offbase, but do you need to set options to cache the results in the original code chunks to reuse in later chunks? (I haven't worked with knitr lately, so this may be nonsense). Cheers, Bert On Fri, Apr 19, 2019 at 2:03 PM Patrick Connolly wrote: > > On 19/04/19 12:13 AM, Thierry

Re: [R] Debugging Rmarkdown

2019-04-19 Thread Jeff Newmiller
I just run each chunk in sequence starting from an fresh restart of R by copying code to the R console. However you can use knitr::purl to extract all of the code into a regular R script to do whatever debugging you are most familiar with. On April 19, 2019 2:03:00 PM PDT, Patrick Connolly wr

Re: [R] Debugging Rmarkdown

2019-04-19 Thread Patrick Connolly
On 19/04/19 12:13 AM, Thierry Onkelinx wrote: > Dear Patrick, > > This is not easy to debug without a reprex > > I would check the content of zzz and wide.i in the loop > > str(wide.i) >  zzz <- rbind(zzz, wide.i) > str(zzz) > That's just what I'm trying to achieve but the debugging doesn't work

Re: [R] Debugging Rmarkdown

2019-04-18 Thread Thierry Onkelinx via R-help
Dear Patrick, This is not easy to debug without a reprex I would check the content of zzz and wide.i in the loop str(wide.i) zzz <- rbind(zzz, wide.i) str(zzz) Note that the Rmd always runs in a clean environment. This might explain the difference Best regards, ir. Thierry Onkelinx Statistic

[R] Debugging Rmarkdown

2019-04-18 Thread Patrick Connolly
I have a function that works in ESS, but it fails if I include it in an .Rmd file that I tried to knit using Rstudio. I found advice at: https://www.rstudio.com/products/rstudio/release-notes/debugging-with-rstudio/ It seems to be not referring to markdown files. Somewhere else suggested calling