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 Packages". When I started writing R packages, I felt it tripled my software development productivity overnight by making it easier to find bugs and keep track of what I had done -- not to mention making it much easier to share my work with others.


      Hope this helps.
      Spencer


On 8/25/2011 11:23 AM, Duncan Murdoch wrote:
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 any way to debug "normally", with breakpoints?

The trace() function does that.  setBreakpoint() is a front end for
it.  One current limitation is that it only allows one breakpoint per
function; that may change soon.

2. I am using the Eclipse plugin (StatET), and tried JGR(). Is there
an IDE
that enables breakpoints?
3. Is there an equivalent to "include" in other programming
languages? So
many functions in one file are very messy. I would like to break it to
several files.

Write a package.  It is much easier than it looks at first.  Start
with package.skeleton, and follow the instructions from there.

4. Any way to create a "local" context of variables inside a function?
Otherwise I have to be careful to give different names inside
functions, to
those in the workspace.

Functions always have a local context for writing.  There's no simple
way to create a local context for reading.

Duncan Murdoch


I should point that I am a long time Matlab user and am probably
expecting
some things that don't necessarily exist in R...

I know it's a lot, if there is a more appropriate forum to ask these,
please
point me in that direction.

Thanks,
Eran.

*

*

    [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.


--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com

______________________________________________
R-help@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.

Reply via email to