[R] Debugging (was Re: HELP!!!)
Duncan Murdoch
murdoch.duncan at gmail.com
Thu Feb 28 13:15:44 CET 2013
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 this,
> |> if you have been using the above statement in your script (which I
> |> always have turned on), you will be able to discover for yourself most
> |> of your bugs. Debugging is an important talent to learn if you are
> |> going to be writing programs/scripts.
>
> Does that have advantages of using a browser() line or two? I find
> them indispensable.
>
The error=utils::recover option will invoke a browser at the time of an
error, so it's very helpful when you don't know where to put the
browser() calls.
You should also consider using trace(), which inserts temporary
browser() calls (or other code). The setBreakpoint() function
constructs a call to trace() using source file information and is often
an easier front end.
Duncan Murdoch
>
> |>
> |> On Fri, Feb 22, 2013 at 2:02 PM, lara sowale <lara.dupe at gmail.com> wrote:
> |> > I am sorry to bug you, I am having this error whenever I want to run
> |> > random effects regression in software R: Error in if (sigma2$id < 0)
> |> > stop(paste("the estimated variance of the", :
> |> > missing value where TRUE/FALSE needed.
> |> >
> |> > Please help me look into it.
> |> >
> |> > [[alternative HTML version deleted]]
> |> >
> |> > ______________________________________________
> |> > R-help at r-project.org mailing list
> |> > https://stat.ethz.ch/mailman/listinfo/r-help
> |> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> |> > and provide commented, minimal, self-contained, reproducible code.
> |>
> |>
> |>
> |> --
> |> Jim Holtman
> |> Data Munger Guru
> |>
> |> What is the problem that you are trying to solve?
> |> Tell me what you want to do, not how you want to do it.
> |>
> |> ______________________________________________
> |> R-help at r-project.org mailing list
> |> https://stat.ethz.ch/mailman/listinfo/r-help
> |> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> |> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list