krc at mdacc.tmc.edu
2007-Mar-15 17:58 UTC
[Rd] Sweave bug using 'FDR' in chunk label (PR#9567)
Full_Name: Kevin Coombes Version: 2.4.0 OS: Windows XP Submission from: (NULL) (143.111.22.24) I'm running R 2.4.0 on a Windows XP machine, with only the default packages loaded. Running Sweave or Stangle on the following Rnw file: -------------- % bug.Rnw \begin{document} Demonstrate an Sweave/Stangle bug. <<info>>sessionInfo() @ <<getFDR>>x <- 1 @ <<getFDX>>y <- 2 @ <<problem>><<getFDX>> <<getFDR>> @ \end{document} --------------- produces an error message:> Stangle("bug.Rnw")Writing to file bug.R Warning message: reference to unknown chunk 'getFDR' in: Sweave(file = file, driver = driver, ...) Here is the relevant part of the "bug.R" file produced by Stangle. Note that the label has been truncated on chunk2 (should be getFDR) but is not affected on chunk3. Also note that chunk4 has not been expanded properly. ################################################### ### chunk number 2: getF ################################################### x <- 1 ################################################### ### chunk number 3: getFDX ################################################### y <- 2 ################################################### ### chunk number 4: problem ################################################### y <- 2
On 3/15/2007 1:58 PM, krc at mdacc.tmc.edu wrote:> Full_Name: Kevin Coombes > Version: 2.4.0 > OS: Windows XP > Submission from: (NULL) (143.111.22.24) > > > I'm running R 2.4.0 on a Windows XP machine, with only the default packages > loaded. > > Running Sweave or Stangle on the following Rnw file: > -------------- > % bug.Rnw > \begin{document} > Demonstrate an Sweave/Stangle bug. > <<info>>> sessionInfo() > @ > > <<getFDR>>> x <- 1 > @ > <<getFDX>>> y <- 2 > @ > <<problem>>> <<getFDX>> > <<getFDR>> > @ > > \end{document}I can confirm this bug in R 2.4.1 and R-devel. It's because of an error in a regular expression in SweaveParseOptions; it is supposed to strip off a trailing ".R", but it doesn't escape the dot, and so it matches the DR in getFDR. I'll fix it in R-devel and R-patched after testing... Duncan Murdoch> --------------- > > produces an error message: > >> Stangle("bug.Rnw") > Writing to file bug.R > Warning message: > reference to unknown chunk 'getFDR' in: Sweave(file = file, driver = driver, > ...) > > > Here is the relevant part of the "bug.R" file produced by Stangle. Note that > the label has been truncated on chunk2 (should be getFDR) but is not affected on > chunk3. Also note that chunk4 has not been expanded properly. > > ################################################### > ### chunk number 2: getF > ################################################### > x <- 1 > > ################################################### > ### chunk number 3: getFDX > ################################################### > y <- 2 > > ################################################### > ### chunk number 4: problem > ################################################### > y <- 2 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel