[Rd] Sweave/ESS-like tools for HTML

Duncan Temple Lang duncan at wald.ucdavis.edu
Tue Oct 16 21:59:13 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Doug.

  This is probably more than you want - either to know or to use
for your specific task, but I'll throw it out there for general
information.

 I write documents using XML, specifically an extended version
of Docbook with elements for describing R concepts (e.g.
code, plot, output, function name, argument, ...).  Then,
I use XSL to transform this to either HTML, FO and on to PDF,
or to LaTeX (via db2latex).  As for processing
the R code and inserting the output into the resulting view/document,
I use the Sxslt package from within R which allows me to combine XSL
rules with those that also call R functions.
I author the documents using the nxml mode in emacs
and have some basic "gestures" for sending code from the document
to R.


Deb Nolan and I use this for creating dynamic and interactive
documents which can be transformed to HTML with embedded
controls for the reader to control the R computations
interactively.

Rather than thinking of the document as being one whose
primary purpose is to be displayed to readers,
the approach allows us to put arbitrary things into the
document as part of our work but render only the bits
we want for a particular audience, e.g. mix code,
pedagogical material, R documentation, data, code
from other languages.

The XML/Docbook-XSL-R approach is very general and flexible
with possibly "too" many degrees of freedom.  If the document is
destined only for HTML, then writing in HTML directly may be
best. The generality is useful when there are multiple targets
and one wants to extract information programmatically, e.g.
extract subsets of the code within the document such as
that in section 2, or only Matlab code.

I will be packaging up all the material we have on this soon,
so if anyone wants a copy, let me know.


  D.

Douglas Bates wrote:
> My university provides me with a powerful course management system for
> the courses that I teach.  Among other things I can create a wiki for
> the course, which is very convenient for cross-linking different bits
> of the course.
> 
> Naturally I use R extensively in my teaching and I want to incorporate
> R code, output and graphics in such a wiki.  If I were producing LaTeX
> sources instead of HTML sources I create .Rnw files for Sweave and I
> would edit them using ESS in emacs.
> 
> What options do I have for producing HTML with embedded R content and
> what is a good, preferably emacs-based, way of editing the source
> code?
> 
> One basic problem is trying to present mathematical expressions in HTML (see
> http://www.cs.tut.fi/~jkorpela/math/) but, aside from that, there are
> questions of presenting input R expressions and the corresponding
> output and of incorporating graphics files produced by R.  I could try
> to use latex2html or texi2html but the output from latex2html at least
> would be quite inconvenient to use because it generates so many linked
> files.  Once they are uploaded it would be horrible trying to get all
> the links straightened out.
> 
> In a sense there are already tools for this type of output from .Rd
> files.  Would it be best to use those tools or to use texinfo tools or
> ...?
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFRgR9p/Jzwa2QP4RAi2vAJ0S+Mnbjvt6z9pe1kPoIxHeaaZQkACggHOL
GflkuedfvPVQfm6fayigGK0=
=4fKz
-----END PGP SIGNATURE-----



More information about the R-devel mailing list