[R] How to extract R codes that embedded in a HTML file

Friedrich Leisch Friedrich.Leisch at stat.uni-muenchen.de
Fri May 18 15:14:48 CEST 2007


  > -------- 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



More information about the R-help mailing list