Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
Thanks a lot both Duncan and Ivan, I will keep that example in mind, Duncan, great! Best regards, Iago De: Duncan Murdoch Enviat el: divendres, 12 d�abril de 2024 15:36 Per a: Iago Gin� V�zquez ; r-help@r-project.org Tema: Re: [R] Debugging functions defined

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Duncan Murdoch
On 12/04/2024 8:15 a.m., Iago Giné Vázquez wrote: Hi all, I am trying to debug an error of a function g defined and used inside another function f of a package. So I have f <- function(whatever){ ... g <- function(whatever2){ ... } ... } If I wanted to debug some thing di

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Ivan Krylov via R-help
В Fri, 12 Apr 2024 12:53:02 + Iago Giné Vázquez пишет: > How should I call trace() if f was a function? Let the tracer be quote(debug(g)) and use as.list(body(f)) to determine where it should be injected: f <- function() { message('exists("g") so far is ', exists('g')) g <- function() {

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
ing a call to debug(g) after it's created. How should I call trace() if f was a function? Best regards, Iago De: Ivan Krylov Enviat el: divendres, 12 d��abril de 2024 14:38 Per a: Iago Gin�� V��zquez A/c: r-help@r-project.org Tema: Re: [R] Debugging functio

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Ivan Krylov via R-help
В Fri, 12 Apr 2024 12:15:07 + Iago Giné Vázquez пишет: > f <- function(whatever){ >... >g <- function(whatever2){ > ... >} >... > } > > If I wanted to debug some thing directly inside f I would do > debug(f). But this does not go inside g code. On the other hand, > debug

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
To be precise, in the case I am looking this time f is not a function, but f <- ggplot2::ggproto(...) So debug(f) produces Error in debug(f) : argument must be a function Iago De: R-help de part de Iago Gin� V�zquez Enviat el: divendres, 12 d�abril de 2024 14:

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

Re: [R] debugging R code and dealing with dependencies

2014-12-25 Thread Mike Miller
On Thu, 25 Dec 2014, David Winsemius wrote: On Dec 25, 2014, at 1:04 AM, Mike Miller wrote: I just wanted to put this out there. It's just some of my observations about things that happen with R, or happened in this particular investigation. There were definitely some lessons for me in thi

Re: [R] debugging R code and dealing with dependencies

2014-12-25 Thread David Winsemius
> On Dec 25, 2014, at 1:04 AM, Mike Miller wrote: > > I just wanted to put this out there. It's just some of my observations about > things that happen with R, or happened in this particular investigation. > There were definitely some lessons for me in this, and maybe that will be > true of

Re: [R] debugging R code and dealing with dependencies

2014-12-25 Thread Mike Miller
Thanks, but I was already in touch with Rob Kirkpatrick about it. We all work together at U Minnesota, or did until Rob went to VCU. Mike On Thu, 25 Dec 2014, Uwe Ligges wrote: This is a rather detailed analysis, thanks, but I think it should be send to the maintainer of the "RFGLS" package

Re: [R] debugging R code and dealing with dependencies

2014-12-25 Thread Uwe Ligges
This is a rather detailed analysis, thanks, but I think it should be send to the maintainer of the "RFGLS" package (CCing). Best, Uwe Ligges On 25.12.2014 10:04, Mike Miller wrote: I just wanted to put this out there. It's just some of my observations about things that happen with R, or happ

Re: [R] Debugging (was Re: HELP!!!)

2013-02-28 Thread Duncan Murdoch
On 13-02-28 4:20 AM, Patrick Connolly wrote: On Fri, 22-Feb-2013 at 02:23PM -0500, jim holtman wrote: |> Run with: |> |> options(error=utils::recover) |> |> Then at the point of the error you will be able to examine sigma2$id |> which is probably not a numeric. Any time you get an error like th

Re: [R] Debugging using RStudio or any other R editor

2012-02-21 Thread Shige Song
Both ESS (with ess-tracebug) and StatET (an R plug-in for Eclipse) has debugger function. Shige On Tue, Feb 21, 2012 at 8:16 AM, R. Michael Weylandt wrote: > ?findLineNum in conjunction with ?setBreakpoint and ?traceback or > options(error=recover) seems like a good strategy within R. Not sure >

Re: [R] Debugging using RStudio or any other R editor

2012-02-21 Thread R. Michael Weylandt
?findLineNum in conjunction with ?setBreakpoint and ?traceback or options(error=recover) seems like a good strategy within R. Not sure what you can get on the IDE end. Michael On Tue, Feb 21, 2012 at 2:38 AM, jpm miao wrote: > Hello, > >   I am using RStudio and have trouble finding out the prob

Re: [R] debugging R

2012-02-05 Thread Duncan Murdoch
On 12-02-05 3:01 AM, Alaios wrote: Dear all, I am using browse() to debug my R applications. My problem is that I need a bit more control of the debugging process. For example 'I want R to stop at the 7th iteration and check. One can do think that I can put the browse inside an if statement bu

Re: [R] debugging R

2012-02-05 Thread michael.zombok
Hi Alex, some hints and advices on debugging can be found in the 'Writing R Extensions Manual': http://cran.r-project.org/doc/manuals/R-exts.html#Debugging-R-code Depending on the IDE/editor you are using, there may be additional debugging tools/options, but without further informations about yo

Re: [R] debugging R

2012-02-05 Thread Gabor Grothendieck
On Sun, Feb 5, 2012 at 3:01 AM, Alaios wrote: > Dear all, > I am using browse() to debug my R applications. My problem is that I need a > bit more control of the debugging process. > > For example 'I want R to stop at the 7th iteration and check. One can do > think that I can put the browse insi

Re: [R] debugging functions in R

2011-08-25 Thread Spencer Graves
See also the debug function, which allows you to walk through a function line by line. I also concur with Duncan's recommendation to try the R package system. I'm an author of one of two contributed documents available from CRAN -> Documentation: Contributed -> "Creating R Packa

Re: [R] debugging functions in R

2011-08-25 Thread Duncan Murdoch
On 11-08-24 10:20 AM, Eran Eidinger wrote: Hi, I am not sure if this is the right list to ask this question (though I did not find a more appropriate one). I've started using R a month ago, and small scripts work fine. However, when I start writing more complex code, it gets messy. 1. Is there

Re: [R] debugging functions in R

2011-08-24 Thread jim holtman
Also check out the 'debug' package On Wed, Aug 24, 2011 at 10:59 AM, Eran Eidinger wrote: > Wow, thanks Justin and Liviu, > > DebugOnce and browser. great! > > Eran > > On Wed, Aug 24, 2011 at 5:34 PM, Justin Haynes wrote: > >> Another great tool is debugonce() >> >> wrap your function name in i

Re: [R] debugging functions in R

2011-08-24 Thread Eran Eidinger
Wow, thanks Justin and Liviu, DebugOnce and browser. great! Eran On Wed, Aug 24, 2011 at 5:34 PM, Justin Haynes wrote: > Another great tool is debugonce() > > wrap your function name in it and then execute your function call. > > debugonce(my.function) > > out<-my.function(df) > > And you'll b

Re: [R] debugging functions in R

2011-08-24 Thread Justin Haynes
Another great tool is debugonce() wrap your function name in it and then execute your function call. debugonce(my.function) out<-my.function(df) And you'll be brought into the same interactive browser. (its Vi if im not mistaken which can take a little getting used to.) Justin On Wed, Aug 2

Re: [R] debugging functions in R

2011-08-24 Thread Liviu Andronic
On Wed, Aug 24, 2011 at 4:20 PM, Eran Eidinger wrote: > Hi, > > I am not sure if this is the right list to ask this question (though I did > not find a more appropriate one). > I've started using R a month ago, and small scripts work fine. However, when > I start writing more complex code, it gets

Re: [R] debugging

2011-02-24 Thread jim holtman
options(error=utils::recover) On Thu, Feb 24, 2011 at 12:06 PM, Yan Jiao wrote: > Dear R user > > > > How to make the program stop at the spot where the error occurs?  I mean > inside the iterations,. > > > > Many thanks > > > > yan > > > **

Re: [R] debugging

2011-02-24 Thread Rainer M Krug
On Thu, Feb 24, 2011 at 6:06 PM, Yan Jiao wrote: > Dear R user > > > > How to make the program stop at the spot where the error occurs?  I mean > inside the iterations,. > Check ?browser ?debug Rainer > > > Many thanks > > > > yan > > > **

Re: [R] Debugging segfault in foreach

2010-11-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/16/2010 04:53 AM, Steve Lianoglou wrote: > Hi, > > I'm using R-2.12 on a linux 64bit machine. > > When I run a chunk of code inside a foreach() %do% { ...} or %dopar% > {...} (with doMC backend) I keep getting a segfault. Running the > *same* c

Re: [R] Debugging segfault in foreach

2010-11-16 Thread Duncan Murdoch
On 15/11/2010 10:53 PM, Steve Lianoglou wrote: Hi, I'm using R-2.12 on a linux 64bit machine. When I run a chunk of code inside a foreach() %do% { ...} or %dopar% {...} (with doMC backend) I keep getting a segfault. Running the *same* code within lapply(something, function(x) ... ) doesn't resu

Re: [R] debugging

2010-10-07 Thread Duncan Murdoch
On 07/10/2010 6:09 AM, Maas James Dr (MED) wrote: I'm attempting to learn how to use the debug function to find the values of some variables. I've found a couple of documents describing the basics and they show examples that the debugger returns "Browse[1]>" but for some reason when I follo

Re: [R] debugging substitute function in R 2.11

2010-05-15 Thread Peter Ehlers
substitute() does not have an argument 'list'; it does have 'env'. Replace this line: list = list (member = as.name (member), with env = list (member = as.name (member), -Peter Ehlers On 2010-05-14 3:09, Gil Tomás wrote: Dear list, A while ago I found in the web a

Re: [R] Debugging issues encountered during the "R CMD check" process

2010-01-07 Thread Jason Rupert
addressing errors that occur during the "R CMD check" process, especially since they are not in the R Console and not possible to "browser()" into the issue... Thanks again for any insights or feedback. - Original Message From: Duncan Murdoch To: Jason Rupert

Re: [R] Debugging issues encountered during the "R CMD check" process

2010-01-07 Thread Uwe Ligges
Dear Jason Rupert, I would need to dig into this and cannot answer yet. But I am about to take over maintainership of the orphaned signal package and already registered an R-forge project (currently I only cleaned up some files without really fixing issues). Have you already invested some wor

Re: [R] Debugging issues encountered during the "R CMD check" process

2010-01-07 Thread Duncan Murdoch
On 07/01/2010 2:48 PM, Jason Rupert wrote: I read through the "Writing R Extensions" and the "Debugging in R" website (http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/), looking for some hints about how to solve the issue of debugging problems encountered during the "R CMD check" proce

Re: [R] debugging package

2010-01-06 Thread Liviu Andronic
Hello On 1/6/10, Markus Weisner wrote: > * checking whether package 'NFIRS' can be installed ... WARNING > Found the following significant warnings: >missing link(s): ~~fun~~ CLASSNAME-class > See '/Users/markus/Dropbox/NFIRS_S4/NFIRS.Rcheck/00install.out' for details. > I am not sure

Re: [R] debugging package

2010-01-06 Thread Uwe Ligges
On 06.01.2010 02:15, Markus Weisner wrote: I am trying to debug a package to submit it to CRAN and am getting a bunch of error messages. Most of the errors are because of the Rd files which were automatically populated by the package.skeleton function. I find the section on documentation to b

Re: [R] Debugging the "unexpected string constant" error in the zp2ssg2.R

2009-11-27 Thread Jason Rupert
Evidently it just needed a little more tweaking... http://n2.nabble.com/Need-help-solving-the-unexpected-string-constant-error-td4077984.html#a4078425 Hopefully all this will work out... - Original Message From: Jason Rupert To: R-help@r-project.org Sent: Fri, November 27, 2009 6:1

Re: [R] debugging S4 methods

2009-10-01 Thread Duncan Murdoch
On 01/10/2009 7:02 AM, sebastian mueller wrote: Hi all, Does anyone know how to debug S4 methods? In my case I want to find an error in the specc-function of the kernlab-package. As this seems to be a S4-method the normal S3 debugging can't be applied apparently (e.g. debug(s3function.someclass)

Re: [R] debugging a try() statement

2008-02-19 Thread Berwin A Turlach
G'day Juliet, On Tue, 19 Feb 2008 21:35:11 -0500 "Juliet Hannah" <[EMAIL PROTECTED]> wrote: > I implemented a try() statement that looks like: > > <- function(index) > { > >reduced_model <- try(glm.fit(X4,n,family=poisson(link="log"))) >full_model <- try(glm.fit(X5,n,family=poisson(lin

Re: [R] Debugging a hanging function within R

2007-11-16 Thread Duncan Murdoch
On 11/16/2007 9:48 AM, Yan Wong wrote: > On 16 Nov 2007, at 14:16, Duncan Murdoch wrote: > >> On 11/16/2007 6:58 AM, Yan Wong wrote: >>> Hi, >>> I can't seem to find a way to do this (i.e. interrupt a routine at >>> an arbitrary time during its run, then step into it using the >>> debugger).

Re: [R] Debugging a hanging function within R

2007-11-16 Thread Yan Wong
On 16 Nov 2007, at 15:05, Gabor Grothendieck wrote: > Try this: > > f <- function() { >for(i in 1:1000) { > if (i == 50) browser() > print(i) > } > } > > # enters debugger when i is 50. > # n/c/Q will step one statement/continue/Quit respectively > f() Thanks. The problem is that

Re: [R] Debugging a hanging function within R

2007-11-16 Thread Gabor Grothendieck
Try this: f <- function() { for(i in 1:1000) { if (i == 50) browser() print(i) } } # enters debugger when i is 50. # n/c/Q will step one statement/continue/Quit respectively f() On Nov 16, 2007 6:58 AM, Yan Wong <[EMAIL PROTECTED]> wrote: > Hi, > > I have an R program which takes

Re: [R] Debugging a hanging function within R

2007-11-16 Thread Yan Wong
On 16 Nov 2007, at 14:16, Duncan Murdoch wrote: > On 11/16/2007 6:58 AM, Yan Wong wrote: >> Hi, >> I can't seem to find a way to do this (i.e. interrupt a routine at >> an arbitrary time during its run, then step into it using the >> debugger). > > If you prepare in advance by using options(

Re: [R] Debugging a hanging function within R

2007-11-16 Thread Duncan Murdoch
On 11/16/2007 6:58 AM, Yan Wong wrote: > Hi, > > I have an R program which takes several days to run, and sometimes > hangs while running, presumably stuck in some sort of loop within a > package function. I don't know where in the program code it is > hanging: it is likely to be within a ro