[R] Problems in Recommending R
Warren Young
warren at etr-usa.com
Tue Feb 3 15:00:54 CET 2009
friedrich.leisch at stat.uni-muenchen.de wrote:
>
> For technical reasons there are some conditions: the homepage is
> maintained via SVN like the R sources, so all should be plain HTML, no
> content management system etc.
Consider using a static templating system, or a higher-level document
language like DocBook's "website" variant; perhaps even Sweave?
The idea is, you write your pages in a non-HTML format that gets
compiled to HTML, just like building a program. Such tools let you do
things like add a common navigation bar to all pages, so you can stop
using frames for the nav bar, add common tags to all pages such as CSS
includes, generate parts of the page programmatically, etc.
I have sites using GTML and WPP for this:
http://sunnyspot.org/wpp/
http://www2.lifl.fr/~beaufils/gtml/
Unfortunately, both are basically abandonware now. I keep using them
because they still work, but if I were starting a new site design, I'd
first look for better-maintained tools.
One option would be to build something similar in R. A simple
templating system might only take a few thousand LOC. R is flexible
enough that the page source could be R code. Something like this:
#!/usr/bin/Rscript
require('rhtml')
foo <- 'bits'
page <- ('
<p>Page body text goes here.</p>
<p>Some [[foo]] of the page can be replaced, or you can
call functions to calculate bits, such as to insert the
current date: [[R(date())]]</p>
')
rhtml::generate(page, navbar = 'templates/navbar.R',
header = 'templates/header.R')
Call the script index.R, run it, and get index.html as output.
A side benefit is that you could generate inline graphics with R. This
would fix the antialiasing problem brought up above: as better graphics
drawing code gets put into R, just rebuild the web site on a machine
with the current version of R.
More information about the R-help
mailing list