[R] help! "browser()" does not get stopped...
Duncan Murdoch
murdoch.duncan at gmail.com
Tue Dec 6 19:21:13 CET 2011
On 06/12/2011 1:17 PM, Michael wrote:
> Thanks a lot!
>
> What I was wondering is:
>
> if we use "find", are the results for locally installed packages, or
> "search_paths", or the functions that are loaded into memory?
It finds what get() would find, so that starts with the current
evaluation frame, and follows the chain back to the base environment.
If you haven't used library() or require() to load a package, it won't
be found.
> I am looking for some command to tell me which functions are currently in
> the memory.
ls() will do that for the current evaluation frame. See its args if you
want to search back through the chain.
> My understanding is that after the first-run of a function, the function is
> loaded into memory and stays there until being unloaded.
That's true, but not relevant. If it hasn't been loaded, a stub is
there, and find() will see the stub.
> If I don't unload the function, then any newly edited version will not be
> loaded and the one in memory is the stale version...
That's not true. As soon as you assign a new value to the name, it will
be replaced. But you need to do the assignment in the right place in
the chain.
Duncan Murdoch
> This might explain a few of my weird problems...
>
> Thanks a lot!
>
> On Tue, Dec 6, 2011 at 12:04 PM, Duncan Murdoch<murdoch.duncan at gmail.com>wrote:
>
> > On 06/12/2011 12:45 PM, Michael wrote:
> >
> >> yeah, any one line command of checking which function is currently in the
> >> memory?
> >>
> >
> > As Uwe said, that's not a very useful thing to do. But if you know the
> > name you're looking for, find() is useful. For example,
> >
> > Browse[1]> find("mean")
> > [1] "package:base"
> >
> > You might also want find("mean", mode="function"), in case you've also got
> > a non-function named "mean".
> >
> > Duncan Murdoch
> >
> > so if I find any function not in the .GlobalEnv.
> >> then I know what the problem is?
> >>
> >> 2011/12/6 Uwe Ligges<ligges at statistik.tu-**dortmund.de<ligges at statistik.tu-dortmund.de>
> >> >
> >>
> >> >
> >> >
> >> > On 06.12.2011 18:29, Michael wrote:
> >> >
> >> >> how do I check and make sure? thx
> >> >>
> >> >
> >> > E.g. insert cat("Hello World!\n") in the first line of your function
> >> you
> >> > called "subroutine".
> >> >
> >> > Best,
> >> > Uwe Ligges
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >> On 12/6/11, Uwe Ligges<ligges at statistik.tu-**d**ortmund.de<http://dortmund.de/>
> >> <ligges at statistik.**tu-dortmund.de<ligges at statistik.tu-dortmund.de>>>
> >>
> >> >> wrote:
> >> >>
> >> >>>
> >> >>>
> >> >>> On 06.12.2011 18:06, Michael wrote:
> >> >>>
> >> >>>> It's weird!
> >> >>>>
> >> >>>> I am sure that I have inserted "browser()" in a sub-routine where I
> >> >>>> wanted to stop and debug...
> >> >>>>
> >> >>>> But when I start running the main function from the separate main
> >> file,
> >> >>>>
> >> >>>> it doesn't stop within the target sub-routine at all.
> >> >>>>
> >> >>>
> >> >>> Probably you are using some package and call the "subroutine" within
> >> the
> >> >>> NAMESPACE of the package rather than the one in .GlobalEnv.
> >> >>>
> >> >>> Uwe Ligges
> >> >>>
> >> >>>
> >> >>> Please help me!
> >> >>>>
> >> >>>> Thanks!
> >> >>>>
> >> >>>> ______________________________****________________
> >> >>>> R-help at r-project.org mailing list
> >> >>>> https://stat.ethz.ch/mailman/****listinfo/r-help<https://stat.ethz.ch/mailman/**listinfo/r-help>
> >> <https://stat.**ethz.ch/mailman/listinfo/r-**help<https://stat.ethz.ch/mailman/listinfo/r-help>>
> >>
> >>
> >> >>>> PLEASE do read the posting guide
> >> >>>> http://www.R-project.org/****posting-guide.html<http://www.r-project.org/**posting-guide.html>
> >> <http://www.**r-project.org/posting-guide.**html<http://www.r-project.org/posting-guide.html>>
> >>
> >>
> >> >>>> and provide commented, minimal, self-contained, reproducible code.
> >> >>>>
> >> >>>
> >> >>>
> >>
> >> [[alternative HTML version deleted]]
> >>
> >>
> >> ______________________________**________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> >> PLEASE do read the posting guide http://www.R-project.org/**
> >> posting-guide.html<http://www.r-project.org/posting-guide.html>
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
>
More information about the R-help
mailing list