[R] Sweave Executes Package Functions Twice

From: Dario Strbenac <D.Strbenac_at_garvan.org.au>
Date: Fri, 15 Apr 2011 21:00:20 +1000 (EST)


Hi,

I've got something strange going on. I'm trying to compile a vignette using Sweave("vignette.Rnw"), and in the first code chunk that illustrates an example, I noticed from the output text I have inside the function, that it is running it twice, because the sequence of message() statements is output on screen twice, and takes twice as long to do.

e.g.
Processing sample 1
Processing sample 2
Processing sample 3
Processing sample 1

Processing sample 2
Processing sample 3

If I open up a new R session, and copy and paste the lines of code from the .Rnw one by one, the function isn't called twice - only one complete set of progress outputs show.

I tried using debug() to get more of an idea of what was happening. The function is called enrichmentPlot, so I did debug(enrichmentPlot), then Sweave("vignette.Rnw"). Execution pauses when it gets to the right code chunk, then I type in "n" at the Browse[2]> prompt, but I don't get any output from debug, like "debugging in:", but it runs for a while and I get all of the messages from within my function, then execution pauses again. But just before it pauses I get the debug output :

debugging in: enrichmentPlot(samples.list, 300) debug: standardGeneric("enrichmentPlot") Browse[2]>

Then I enter "n", and it runs the same code all over again.

... ... # Same progress outputs from inside my function. exiting from: enrichmentPlot(samples.list, 300)

I have the current 2.13.0 version of R. I'm sure I've done something wrong, I just can't figure out what. Thanks for any help.



Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia


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. Received on Fri 15 Apr 2011 - 12:26:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Apr 2011 - 12:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive