Description Usage Arguments Details Value Note Author(s) References See Also Examples
Opens an HTML page/document, allowing a sequential building of an HTML page.
1 2 3 4 5 |
filename |
A character string containing the filename or the path of the HTML file to be created. |
dirname |
An optional character string containing the path of the directory where the file should be written. |
title |
An optional character string containing the title of the HTML page. |
doctype |
A character string containing a |
link.javascript |
An optional character vector containing the URL of JavaScripts to be associated with the page. |
link.css |
An optional character vector containing the URL of CSS stylesheets to be associated with the page. |
css |
An optional character vector containing inline CSS stylesheets to be associated with the page. |
head |
An optional character string containing an HTML fragment
to be added in the |
head.attributes |
An optional named list of character strings,
containing the |
body.attributes |
An optional named list of character strings,
containing the |
newPage
opens a new file for writing and returns a page handle
which is used by hwrite
to append HTML elements in a current
page. Any previous existing file will be overwritten.
The doctype
argument is used to specify the document type and
level of HTML syntax. Valid forms may be found at
http://www.w3.org/QA/2002/04/valid-dtd-list.html.
link.javascript
produces A <script>
tag specifying the
language as JavaScript and stating the location of the
code. hwriterPlus uses MathJax from
http://www.mathjax.org/. The JavaScript may either be loaded
from the MathJax site, or from a local file. The former option
requires an active internet connection, while the latter requires that
MathJax must have been installed locally. The form of the text for
this argument is "path-to-MathJax/MathJax.js"
. See the examples
for the appropriate text when loading from MathJax directly. Details
of how to ensure MathJax is loaded, for Version 2 of MathJax may be
found at http://www.mathjax.org/docs/2.0/configuration.html.
The argument head
is useful to add extra HTML code in the
<head>
header code.
head.attributes
is useful to add extra attributes in the
<head>
head code. A description of possible head attributes may
be found at http://www.w3schools.com/tags/tag_body.asp.
body.attributes
is useful to add extra attributes in the
<body>
body code. A description of possible body attributes may
be found at http://www.w3schools.com/tags/tag_body.asp.
To allow the numbering of displayed equations newPage
creates a
global variable called hwriterEquation
and assigns it the value
zero. This variable will be updated when a numbered equation is written
to the HTML file so that it always records the number of the last
numbered equation. It also creates a a global vector named
hwriterEquationList
, which is initially empty, but will contain
the labels of any numbered equations.
A connection which is a handle to the current HTML page.
newPage
is a modification of openPage
from hwriter
which includes a doctype
argument but eliminates the
charset
and lang
arguments provided by openPage
.
David Scott d.scott@auckland.ac.nz
An invaluable source of information concerning valid HTML code and options is the website http://www.w3schools.com/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ### The same as the example from openPage, with newPage replacing
### openPage
### Creates a new web page 'test.html' in the R temporary directory
tmpdir <- tempdir()
p <- newPage('test.html', dirname = tmpdir,
link.css = 'http://www.ebi.ac.uk/~gpau/hwriter/hwriter.css')
hwrite('Iris example', p, center = TRUE, heading = 1)
hwrite('This famous (Fisher\'s or Anderson\'s) iris data set gives the
measurements in centimeters of the variables sepal length and
width and petal length and width, respectively, for 50 flowers
from each of 3 species of iris.', p, class = 'king')
hwrite(iris, p, row.bgcolor = '#ffffaa')
closePage(p)
### Opens a web browser on the web page
if (interactive()) try(browseURL(file.path(tmpdir, 'test.html')))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.