Friedrich Leisch
2007-May-18 13:14 UTC
[R] How to extract R codes that embedded in a HTML file
> -------- Original Message --------> Subject: Re: [R] How to extract R codes that embedded in a HTML file > using Stangle? > Date: Thu, 17 May 2007 17:01:30 +0000 > From: Tao Shi <shitao at hotmail.com> > To: ligges at statistik.uni-dortmund.de, lecoutre at stat.ucl.ac.be > CC: r-help at stat.math.ethz.ch > : <jmcconnell at applied-insights.co.uk> > Hi Uwe, > Thanks for the answer, but I still need a bit more clearification. I > always > thought that a .rnw or .snw file is a file mixing word processing markup > (e.g. tex or HTML) and R/S code using noweb syntax. Is the reason for > 'Stangle' is not working with .rnw file with HTML due to there is no proper > driver available (like RweaveHTML driver for Sweave)? If yes, does R2HTML > package have plans to provide a such driver? > ....Tao The following does the trick for me: R> mytangle <- function () list(setup = RtangleSetup, runcode = utils:::RtangleRuncode, writedoc = RtangleWritedoc, finish = utils:::RtangleFinish, checkopts = RweaveHTMLOptions) R> Stangle("/PATH/TO/R/SITE-LIBRARY/R2HTML/samples/example1.snw", driver=mytangle) Writing to file example1.R Best, Fritz
Works perfectly! Thank you very much, Fritz! ....Tao>From: Friedrich Leisch <Friedrich.Leisch at stat.uni-muenchen.de> >To: Tao Shi <shitao at hotmail.com>, ligges at statistik.uni-dortmund.de, >lecoutre at stat.ucl.ac.be, r-help at stat.math.ethz.ch >Subject: Re: [R] How to extract R codes that embedded in a HTML file >Date: Fri, 18 May 2007 15:14:48 +0200 > > > > -------- Original Message -------- > > Subject: Re: [R] How to extract R codes that embedded in a HTML file > > using Stangle? > > Date: Thu, 17 May 2007 17:01:30 +0000 > > From: Tao Shi <shitao at hotmail.com> > > To: ligges at statistik.uni-dortmund.de, lecoutre at stat.ucl.ac.be > > CC: r-help at stat.math.ethz.ch > > > : <jmcconnell at applied-insights.co.uk> > > > Hi Uwe, > > > Thanks for the answer, but I still need a bit more clearification. I > > always > > thought that a .rnw or .snw file is a file mixing word processing >markup > > (e.g. tex or HTML) and R/S code using noweb syntax. Is the reason for > > 'Stangle' is not working with .rnw file with HTML due to there is no >proper > > driver available (like RweaveHTML driver for Sweave)? If yes, does >R2HTML > > package have plans to provide a such driver? > > > ....Tao > > >The following does the trick for me: > >R> mytangle <- function () > list(setup = RtangleSetup, runcode = utils:::RtangleRuncode, > writedoc = RtangleWritedoc, > finish = utils:::RtangleFinish, checkopts = RweaveHTMLOptions) > >R> Stangle("/PATH/TO/R/SITE-LIBRARY/R2HTML/samples/example1.snw", > driver=mytangle) >Writing to file example1.R > > >Best, >Fritz > >_________________________________________________________________ PC Magazine?s 2007 editors? choice for best Web mail?award-winning Windows Live Hotmail.