# htmlMaker - generate html webpages
#
# R code to generate html code for webpages, especially for batch
# jobs where R is run in background mode. This is a quick hack to
# get simple webpages with graphs, including simple clickable graphs,
# it is not a web design tool. You will need to know some html to
# do anything beyond the simplest webpages.
#
# For the record, there are other more sophisticated packages that
# will allow you to do these (and more) things: S2HTML, SJAVA, R Orca.
#
# These programs can be run in interactive mode (RGui on Windows,
# R on linux), sourcing this file, then executing (or sourcing)
# your commands. Or, you can run in batch mode by putting your input
# commands in a file (e.g. "Rterm --no-save < input.file" on Windows,
# "R BATCH --no-save input.file" on linux).
#
# This code was developed while a visitor at the National Institutes
# of Health (NIH/CIT/MSCL). Permanent address:
#
# John Nolan
# Math/Stat Department
# American University
# 4400 Massachusetts Avenue, NW
# Washington, DC 20016-8050 USA
#
# jpnolan@american.edu
# http://academic2.american.edu/~jpnolan
#
# htmlPlot based on code by Landon Jensen (lsjensen@micron.com)
# and M. D. Thuleen (MDTHULEEN@micron.com)
#
################# Overview #############################################
#
# The code builds webpages by a sequence of calls:
#
# (1) htmlPageBegin - opens the html output file and writes header stuff
# (2) htmlLine - writes a single line of output to the file (you can insert
# any html desired using this)
# (3) htmlPageEnd - appends the closing html code
#
# The plot functions are:
# htmlPlot for (x,y) plot
# htmlBarPlot for a barplot
# htmlBoxPlot for box plots of a multiple data sets
# These plot functions work by
# (1) creating a plot in a separate file from the data supplied.
# These plot files are in PNG format and are written to the
# same path as the one specified in htmlPageBegin.
# (2) adding html code to the webpage to show the plot and optionally to
# make it clickable.
#
# The plot functions allow extra arguments (using the "..." mechanism)
# to be passed directly to the plot function. This allows a savvy user
# to set plot regions size (xlim=,ylim=), axes labels (xlab=,ylab=),
# color, etc. Any argument that doesn't conflict with the what this
# code uses can be specified.
#
# There is support for generating simple tables.
# htmlWriteTable - writes a vector or matrix of values
# You can generate more complex tables manually with
# htmlTableBegin - to start a table
# htmlTableRow - to fill in each row of the table
# htmlTableEnd - to end a table
#
# You can include any type of plot in a webpage, though only the
# ones produced inside this package (htmlPlot, htmlBarPlot, htmlBoxPlot)
# can be "clickable". (This is because a clickable graph must have a
#