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
--
Gregoire Pau
EMBL Research officer
http://www.ebi.ac.uk/~gpau/
Tena Sakai wrote:
Hi,
How can I get R to insert such line into the head section
of html file being generated under hwriter?
I found an answer myself. It turns out that the line
<link rel="stylesheet" type="text/css" href="hwriter.css"></link>
doesn't have to go into body section. As an experiment, I did:
p = openPage ('testPage.html')
hwrite ('<link rel="stylesheet" type="text/css" href="hwriter.css"></link>',
p)
hwrite (iris[1:3,1:3], p, row.bgcolor='#ffda99')
closePage (p)
browseURL ('testPage.html')
and I get what I wanted.
If you have a better/different idea, I'd love to hear it.
Regards,
Tena Sakai
tsa...@gallo.ucsf.edu
-----Original Message-----
From: r-help-boun...@r-project.org on behalf of Tena Sakai
Sent: Thu 4/30/2009 3:56 PM
To: r-help@r-project.org
Subject: [R] newbie HWRITER package question
Hi,
I am playing with hwriter examples given in "example" page.
Here's what I've done:
library (hwriter)
p = openPage ('table.html')
hwrite (1:5, p)
hwrite (iris[1:3, 1:3], p, row.bgcolor='#ffdc98')
closePage (p)
browseURL('table.html')
What I get is not as nice as what I see via the "example"
page. I looked at the html source for the example page
and got a notion maybe I should stick this line between
<head> and </head>:
<link rel="stylesheet" type="text/css" href="hwriter.css"></link>
(I had copied this file into the current working directory.)
and bingo! Yeeehaa! My page suddenly looks so much nicer!
So, here's today's newbie quesion:
How can I get R to insert such line into the head section
of html file being generated under hwriter?
I would appreciate your guidance.
Thank you.
Regards,
Tena Sakai
tsa...@gallo.ucsf.edu
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.