That's quite nice. I see you did post about it last September when it
was added to the devel version of R:
http://www.mail-archive.com/r-devel@r-project.org/msg17708.html
Relative to this discussion what would be useful would be a facility
that debugs not only a function but also all embedded fun
On 23/02/2010 9:35 PM, Ben wrote:
Thanks to everyone for the responses so far. I didn't know about
setBreakpoint, mlocal, or proto before.
I think I'll try using proto a lot more and see if that fixes most of
my problems. It appeals to me for two bad reasons: I had run across
proto when readin
Thanks to everyone for the responses so far. I didn't know about
setBreakpoint, mlocal, or proto before.
I think I'll try using proto a lot more and see if that fixes most of
my problems. It appeals to me for two bad reasons: I had run across
proto when reading the code to ggplot2 earlier but di
I'm going to suggest something that is probably not the coolest thing to do,
but it gets me by with almost all my debugging. I set options(error=recover)
and then in the function I want to debug I put some unassigned variable name
on the first line (example: ThisIsMyDebuggingVariable). Then I will
On 22/02/2010 10:15 PM, Gabor Grothendieck wrote:
As you mention ease of debugging basically precludes subfunctions so
style 1 is left.
I think you are also unaware of setBreakpoint() (and trace(), which
underlies it). So more detail:
If you put this into file test.R, starting on line 1:
o
Ben--
FWIW my general take on this is:
- Namespaces solve the collision issue.
- Style 2 tends to make for unreadably long code inside Foo, unless the
subfunctions are really short.
- Style 3 is too hard to work with
- So I usually use a variant on style 1:
### Style 4 (m
As you mention ease of debugging basically precludes subfunctions so
style 1 is left.
Functions can be nested in environments rather than in other functions
and this will allow debugging to still occur.
The proto package which makes it particularly convenient to nest
functions in environments giv
On 22/02/2010 9:49 PM, Ben wrote:
Hi all,
I'm hoping someone could tell me what best practices are as far as
keeping programs organized in R. In most languages, I like to keep
things organized by writing small functions. So, suppose I want to
write a function that would require helper function