Skip to content
Prev 179008 / 398506 Next

newbie HWRITER package question

Hi Tena,

To associate a CSS stylesheet to your web page with the package 
'hwriter', you just have to use the 'link.css' argument of the method 
'openPage' (as documented in ?openPage). Your example will then become:

library(hwriter)
lcss = 'http://www.ebi.ac.uk/~gpau/hwriter/hwriter.css'
p = openPage ('testPage.html', link.css=lcss)
hwrite (iris[1:3,1:3], p, row.bgcolor='#ffda99')
closePage (p)
browseURL ('testPage.html')

'lcss' could be also 'hwriter.css' if the file is in your local path.

The package 'hwriter' is also able to deal with Javascript. The 
following cool example displays an interactive HTML sortable table, 
using Javascript capabilities:

library(hwriter)
lcss = 'http://www.ebi.ac.uk/~gpau/hwriter/hwriter.css'
lj = 'http://www.kryogenix.org/code/browser/sorttable/sorttable.js'
p = openPage('test.html', link.css=lcss, link.javascript=lj)
hwrite(iris, p, table.class='sortable', row.bgcolor='#fff4f4')
closePage(p)
browseURL('test.html')

Hope this helps,
Best regards,

Greg