hwriter/0000755000175100001440000000000014224012707011753 5ustar hornikusershwriter/NAMESPACE0000644000175100001440000000051514223231073013171 0ustar hornikusersimportFrom("grDevices", "dev.print", "png") importFrom("stats", "na.omit") importFrom("utils", "browseURL", "sessionInfo") export('hwrite', 'openPage', 'closePage', 'hwriteImage', 'hmakeTag') S3method(hwrite, character) S3method(hwrite, numeric) S3method(hwrite, matrix) S3method(hwrite, array) S3method(hwrite, data.frame) hwriter/man/0000755000175100001440000000000012376053510012531 5ustar hornikusershwriter/man/hwrite.Rd0000644000175100001440000001401111473525402014320 0ustar hornikusers\name{hwrite} \alias{hwrite} \title{HTML writer} \description{ Outputs an R object in HTML format. } \usage{ hwrite(x, page=NULL, ...) } \arguments{ \item{x}{an R object to output in HTML format. Objects of type \code{character}, \code{vector}, \code{matrix} and \code{data.frame} are currently supported. } \item{page}{an optional connection, a character string naming the file to write to or a page object returned by \code{openPage}.} \item{...}{optional arguments. See Details.} } \value{ A character vector containing the output HTML code. } \details{ If \code{x} is a vector of only one element, it will be written by default as an HTML text element unless \code{table} is \code{TRUE}: in that case, it will be written as an HTML table containing an unique element. If \code{x} is a vector of more than one element, a matrix or a data.frame, it will be written by default as an HTML table unless \code{table} is \code{FALSE}: in that case, it will be written as a vector or a matrix of HTML text elements. Many optional arguments can be used to render an HTML object. See below for additional information. Many comprehensive examples can be found in the Examples section by typing \code{example(hwrite)}. } \section{General arguments}{ The following optional arguments can always be used: \describe{ \item{br}{a logical specifying if a breakline (carriage return) should be appended at the end of \code{x}. Default is \code{FALSE}.} \item{table}{a logical controlling if the object \code{x} should be written as an HTML table. Default is \code{TRUE} for matrices and vectors containing more than one element, and \code{FALSE} otherwise. If set to \code{FALSE}, the object is written as a vector (or a matrix) of HTML text elements.} \item{link}{a character vector containing the URLs the HTML element will point to. This argument is the equivalent of the attribute \code{href} of the HTML tag .} \item{name}{a character string naming the HTML element for further reference. This is the equivalent of the attribute \code{name} of the HTML tag .} \item{div}{a logical. If \code{TRUE}, places the HTML element into a HTML section, using the
HTML tag. This is helpful for styling a section. Default is \code{FALSE}.} \item{center}{a logical indicating if \code{x} should be centered. Default is \code{FALSE}. This element may interfere with the current CSS style. Please consider the use the CSS style attribute "text-align" instead.} \item{...}{Additional arguments are added to the HTML element as HTML attributes. For HTML tables, attributes are distributed on table cells using R recycling rules. For text elements, a HTML tag (or
if \code{div} is \code{TRUE}) is used to accommodate the attributes.} } } \section{Additional arguments for text elements}{ If \code{x} is rendered as an HTML text element, the following optional arguments can be used: \describe{ \item{heading}{a numeric containing the heading level style. Valid values spans from 1 to 5. See Examples.} } } \section{Additional arguments for vectors}{ If \code{x} is a vector with more than one element, the following optional arguments can be used: \describe{ \item{dim}{a couple of optional numeric values indicating the desired number of rows and columns in the table. This is useful to orient a vector.} \item{byrow}{logical. If \code{TRUE}, the table is filled by rows first, otherwise the table is filled by columns first. Default is \code{FALSE}.} \item{names}{a logical indicating if the names of the elements should be written if the vector is named. Default is \code{TRUE}.} } } \section{Additional arguments for tables}{ If \code{x} is rendered as an HTML table element, the following optional arguments can be used: \describe{ \item{border}{a numeric. Specifies the table border width. A value of 0 implies that no borders will be drawn. This argument may interfere with the "border" CSS style attribute.} \item{row.names, col.names}{a logical value indicating whether the row (resp. column) names of \code{x} are to be written. Default is \code{TRUE}.} \item{cellspacing, cellpadding}{a numeric. Defines the spacing and padding space in pixels between cells. These arguments may interfere with the "border" and "padding" CSS style attributes.} \item{width}{a character string. Specifies the global table width in HTML units (pixels or \%).} \item{col.width}{a named character vector. Specifies the columns width in HTML units (pixels or \%) where names of \code{col.width} are used to point column names of \code{x}. NAs may be used to let several column widths unspecified.} \item{row.*, col.*}{a list of character vectors or a character vector. Distributes the attribute '*' on the HTML table cells, according to rows (resp. columns). Named lists (or vectors) point the corresponding rows/columns, according to their names. Unnamed lists (or vectors) point the rows/columns in the numeric order and NAs can be used to omit rows/columns. If pointed rows/columns sizes don't match, vector values are recycled using R rules.} \item{table.*}{a character string. Uses the global table attribute '*' to render the HTML table. The attribute is added to the main tag. Some uses include setting of the "border" and "margin" CSS attributes that cannot be distributed on cells.} \item{*}{a character string, vector or matrix. Distributes the attribute '*' on the HTML table cells, using R recycling rules. Any valid HTML attributes can be used. The value may contain NAs to omit cells. Matrices may contain one extra row and/or column to target heading cells.} } See Examples for many illustrated examples of all arguments. } \seealso{ \code{\link{openPage}}, \code{\link{closePage}}, \code{\link{hwriteImage}}, \code{\link{hmakeTag}}. } \examples{ hwriter:::showExample() } \author{ Gregoire Pau, \email{gpau@ebi.ac.uk}, 2008 } \keyword{interface} hwriter/man/hwriteImage.Rd0000644000175100001440000000515411473525402015273 0ustar hornikusers\name{hwriteImage} \alias{hwriteImage} \title{Insert an HTML image} \description{ Inserts one or several images in an HTML document. The images can be either external ones specified by URL or file path, or captured from the current graphic device. } \usage{ hwriteImage(image.url, page=NULL, ..., image.border=0, width=NULL, height=NULL, capture=FALSE) } \arguments{ \item{image.url}{a character vector or matrix containing the URL or the file path of images.} \item{page}{an optional connection, a character string naming the file to write to or a page object returned by \code{openPage}.} \item{image.border}{an optional numeric value specifiying the width of the image border. Default is 0.} \item{width, height}{an optional HTML length unit (in pixels) specifiying the width (resp. height) at which the image should be rendered. If missing, the default image width (resp. height) will be used.} \item{capture}{a logical. If \code{TRUE} the image from the current graphic device is captured and written as a PNG file to the filename specified by \code{image.url}. Capture resolution is controlled by \code{width} and \code{height}, which have a default value of 400 pixels. Default is \code{FALSE}.} \item{...}{optional arguments that will be dispatched to the underlying \code{hwrite} call.} } \value{ A character vector containing the output HTML code. } \details{ \code{hwriteImage} constructs an HTML tag to insert one or several images. This function can be seamlessly in conjuction with \code{hwrite} to position an image. The \code{capture} argument enables to capture easily a current plot and to insert it in a web page. By default, if \code{image.url} is a vector the output value will be a character string containing the HTML code of a table containing the images. This behaviour is dictated by the underlying \code{hwrite} call made by \code{hwriteImage}. The argument \code{table} can be set to \code{TRUE} to obtain a vector of HTML image tags instead. } \seealso{ \code{\link{hwrite}}. } \examples{ ## Creates a new web page 'test.html' tmpdir <- tempdir() p <- openPage('test.html', dirname=tmpdir) ## Insert an external image img <- hwriteImage('http://www.ebi.ac.uk/~gpau/hwriter/iris1.jpg', center=TRUE) hwrite(c(img,caption='Iris'), p, dim=c(2,1), row.style=list(caption='text-align:center;background-color:#fac'), row.names=FALSE, br=TRUE) ## Closes the web page closePage(p) ## Opens a web browser to see the result if (interactive()) try(browseURL(file.path(tmpdir, 'test.html'))) } \author{ Gregoire Pau, \email{gpau@ebi.ac.uk}, 2008 } \keyword{interface} hwriter/man/hmakeTag.Rd0000644000175100001440000000216111473525402014542 0ustar hornikusers\name{hmakeTag} \alias{hmakeTag} \title{HTML/XML tag formatter} \description{ Formats an HTML/XML tag, using a low-level syntax. } \usage{ hmakeTag(tag, data=NULL, ..., newline=FALSE) } \arguments{ \item{tag}{a character vector or matrix containing the HTML/XML tags.} \item{data}{a character vector or matrix containing the tag bodies.} \item{newline}{a logical. Appends a newline \code{\\n} character at the end of the tags.} \item{...}{optional attributes that will be appended to the tags.} } \value{ A character vector or matrix, containing the output HTML/XML tags. } \details{ This low-level function is used by \code{hwrite} to build HTML tags. This function is useful to build non-standard or rare HTML tags. } \seealso{ \code{\link{hwrite}}. } \examples{ ## simple call hmakeTag('a','Centipede',href='http://en.wikipedia.org/wiki/Centipede') ## vectorized calls hmakeTag('tag',1:10,color='red') hmakeTag(colors()[1:10],1:10,semantic='color') ## nested calls hmakeTag('html',hmakeTag('body','Text'),'xml:lang'='en') } \author{ Gregoire Pau, \email{gpau@ebi.ac.uk}, 2008 } \keyword{interface} hwriter/man/openPage.Rd0000644000175100001440000000622512376054101014560 0ustar hornikusers\name{openPage} \alias{openPage} \alias{closePage} \title{HTML document/page management} \description{ Opens and closes an HTML page/document, allowing a sequential building of an HTML page. } \usage{ openPage(filename, dirname=NULL, title=filename, link.javascript=NULL, link.css=NULL, css=NULL, head=NULL, charset="utf-8", lang="en", head.attributes=NULL, body.attributes=NULL) closePage(page, splash=TRUE) } \arguments{ \item{filename}{a character string containing the filename or the path of the HTML file to be created.} \item{dirname}{an optional character string containing the path of the directory where the file should be written.} \item{title}{an optional character string containing the title of the HTML page.} \item{link.javascript}{an optional character vector containing the URL of Javascripts to be associated with the page.} \item{link.css}{an optional character vector containing the URL of CSS stylesheets to be associated with the page.} \item{css}{an optional character vector containing inline CSS stylesheets to be associated with the page.} \item{head}{an optional character string containing an HTML fragment to be added in the section of the page.} \item{charset}{an optional character string containing the current charset. Default is "utf-8".} \item{lang}{an optional character string containing the current langage. Default is "en".} \item{head.attributes}{an optional named list of character strings, containing the attributes.} \item{body.attributes}{an optional named list of character strings, containing the attributes.} \item{page}{a page handle returned by a previous \code{openPage} call.} \item{splash}{a logical, indicating whether the hwriter splash tag 'generated by...' should be written at the end of the page.} } \value{ A connection which is a handle to the current HTML page. } \details{ \code{openPage} opens a new file for writing and returns a page handle which is used by \code{hwrite} to append HTML elements in a current page. Any previous existing file will be overwritten. The argument \code{head} is useful to add extra HTML code in the header code. \code{closePage} ends the HTML page formatting, flushes the pending writing operations and closes the file. } \seealso{ \code{\link{hwrite}}, \code{\link{hmakeTag}}. } \examples{ ## Creates a new web page 'test.html' in the R temporary directory tmpdir <- tempdir() p <- openPage('test.html', dirname=tmpdir, link.css='http://www.ebi.ac.uk/~gpau/hwriter/hwriter.css') hwrite('Iris example', p, center=TRUE, heading=1) hwrite(paste('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'))) } \author{ Gregoire Pau, \email{gpau@ebi.ac.uk}, 2008 } \keyword{interface} hwriter/man/hwriter-package.Rd0000644000175100001440000000224614224007227016077 0ustar hornikusers\name{hwriter-package} \alias{hwriter} \docType{package} \title{HTML writer} \description{ \code{hwriter} is an easy-to-use package able to format and output R objects in HTML format. It supports advanced formatting, tables, CSS styling, Javascript, images and provides a convenient mapping between R tables and HTML tables. \code{hwriter} generates XHTML 1.0 transitional HTML code. See Examples and \code{hwrite} for more details. %% The project page is \url{http://www.ebi.ac.uk/~gpau/hwriter}. } \section{Package content}{ \code{hwriter} provides the following functions (but most of the job is carried out by \code{hwrite}): \itemize{ \item \code{hwrite} outputs an R object in HTML format. \item \code{hwriteImage} writes an image. \item \code{openPage}, \code{closePage} handles HTML page/document creation. \item \code{hmakeTag} is a low-level HTML tag formatting function. } } \seealso{ \code{\link{hwrite}}, \code{\link{hwriteImage}}, \code{\link{openPage}}, \code{\link{closePage}}, \code{\link{hmakeTag}}. } \examples{ hwriter:::showExample() } \author{ Gregoire Pau, \email{gpau@ebi.ac.uk}, 2008 } \keyword{interface} hwriter/TODO0000644000175100001440000000041711473525402012451 0ustar hornikusersTODO: - lists - split.table, split.table.args -
headings,
tag - FIX: col.width doesn't work if nothing is present on the first row - FIX: split.max.x require a matrix for link even if data is a 1-row vector - icolwidth logic to be synced with rowcol logic hwriter/DESCRIPTION0000755000175100001440000000066714224012707013475 0ustar hornikusersPackage: hwriter Title: HTML Writer - Outputs R Objects in HTML Format Version: 1.3.2.1 Author: Gregoire Pau Depends: R (>= 2.6.0) Description: Easy-to-use and versatile functions to output R objects in HTML format. Maintainer: Gregoire Pau License: LGPL-2.1 Packaged: 2022-04-08 10:29:52 UTC; hornik Repository: CRAN Date/Publication: 2022-04-08 11:00:23 UTC NeedsCompilation: no hwriter/build/0000755000175100001440000000000014224007240013046 5ustar hornikusershwriter/build/vignette.rds0000644000175100001440000000034514224007240015407 0ustar hornikusersuP @]/]4XB$ ć^sT/r%7ٝ3g%6,bZZ9 6q\V$גW%2*s5KtGVVrP.|hֽ2ퟟZ9@]|<((6:m{[ E7] Pb.Nju !5"]d4GT[:4}I}n$3?hwriter/vignettes/0000755000175100001440000000000014224007240013757 5ustar hornikusershwriter/vignettes/hwriter.Rnw0000644000175100001440000000341411473525402016145 0ustar hornikusers% \VignetteIndexEntry{Description of the package hwriter} % \VignetteKeywords{HTML, hwriter} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{hyperref} \clearpage \parindent 0in % Left justify \newcommand{\Rpackage}[1]{\textsf{#1}} \newcommand{\Rfunction}[1]{\textit{#1}} \newcommand{\Robject}[1]{\texttt{#1}} \newcommand{\Rclass}[1]{{\textit{#1}}} \newcommand{\Rmethod}[1]{{\textit{#1}}} \newcommand{\Rfunarg}[1]{{\textit{#1}}} \SweaveOpts{eps=FALSE} \title{The hwriter package} \author{Gregoire Pau} \begin{document} \maketitle \section{Description} The package \Rpackage{hwriter} is an easy-to-use package able to format and output R (from the R-project) objects in HTML format. It supports advanced formatting, tables, CSS styling, images and provides a convenient mapping between R tables and HTML tables. The project page is \url{http://www.ebi.ac.uk/~gpau/hwriter}. The package provides the following functions (but most of the job is carried out by \Rfunction{hwrite}): \begin{itemize} \item \Rfunction{hwrite} outputs an R object in HTML format. \item \Rfunction{hwriteImage} writes an image. \item \Rfunction{openPage, closePage} handles HTML page/document creation. \item \Rfunction{hmakeTag} is a low-level HTML tag formatting function. \end{itemize} All the functions are documented in the manual pages. Please check them for reference. \section{Example} It is not easy to render what an HTML writing package could do in a PDF document. The following example produces a local web page named \Rfunction{example-hwriter.html} which contains many documented examples, all with R sources and resulting HTML outputs. % <>= library('hwriter') example('hwriter') @ % \end{document} hwriter/R/0000755000175100001440000000000011473677035012172 5ustar hornikusershwriter/R/hwriter.R0000644000175100001440000001010412376052107013763 0ustar hornikusershwrite=function(x,page=NULL,...) UseMethod('hwrite') hwrite.character=function(x,...) hwrite.vector(x,...) hwrite.numeric=function(x,...) hwrite.vector(x,...) hwrite.array=function(x,...) hwrite.table(x,...) hwrite.matrix=function(x,...) hwrite.table(x,...) hwrite.data.frame=function(x,...) hwrite.table(as.matrix(x),...) ## switch between hwriteString and hwrite.matrix ## redimension 'dim' and 'byrow' matrix orientation hwrite.vector=function(data,page=NULL,...,table=NULL,names=NULL,byrow=NULL,dim=NULL) { ## default arguments if (is.null(table)) { if (length(data)<=1) table=FALSE else table=TRUE } if (is.null(names)) names=TRUE if (is.null(byrow)) byrow=FALSE if (table) { if (is.null(dim)) dim=c(1,length(data)) datanames=names(data) data=matrix(data,nrow=dim[1],ncol=dim[2],byrow=byrow) mode(data)='character' ## preserve names, if possible if (names) { if (dim[1]==length(datanames)) rownames(data)=datanames if (dim[2]==length(datanames)) colnames(data)=datanames } hwrite.matrix(data,page=page,...) } else hwriteString(data,page=page,...) } ## private ## final string writing function hwriteString=function(txt,page=NULL,...,link=NULL,name=NULL,heading=NULL,center=NULL,br=NULL,div=NULL) { ## default arguments if (is.null(br)) br=FALSE if (is.null(center)) center=FALSE if (is.null(div)) div=FALSE args=list(...) ## box text with: ## - 'a' if link is non-null or name is non-null ## - 'h*' if heading is non-null ## - 'div' if div is TRUE ## - 'span' if args are present ## - no box otherwise ## ## also: removes tags if corresponding href and argument values are NA boxtag=NULL if (!is.null(link)) { args=c(args, list(href=link)) boxtag = rep('a', length(link)) boxtag[is.na(link)] = NA } else if (!is.null(name)) { args=c(args, list(name=name)) boxtag = rep('a', length(name)) boxtag[is.na(name)] = NA } else if (!is.null(heading)) boxtag=paste('h',heading,sep='') else if (div) boxtag='div' else if (length(args)>0) boxtag='span' ## box text if (!is.null(boxtag)) txt=do.call(hmakeTag,c(list(boxtag,txt),args)) ## center if (center) txt=hmakeTag('center',txt) ## line break if (br) txt=paste(txt,'
\n',sep='') ## final output if (is.null(page)) txt else if (is.character(page)) { p=openPage(page) cat(txt,file=p) closePage(p) invisible(txt) } else invisible(cat(txt,file=page)) } hwriteImage=function(image.url,page=NULL,...,image.border=0,width=NULL,height=NULL,capture=FALSE) { ## take a snapshot of the current device ? if (capture) { if (is.null(width)) width=400 if (is.null(height)) height=400 dev.print(png,width=width,height=height,image.url) } str=hmakeTag('img',border=image.border,src=image.url,alt=image.url,width=width,height=height) ## final hwrite(str,page,...) } resync=function() { try(detach('package:hwriter'),silent=TRUE) hwrite=NULL source('R/hwriter.R') source('R/page.R') source('R/table.R') source('R/example.R') library(hwriter) } hmakeTag = function(tag, data=NULL, ..., newline=FALSE) { attrs = list(...) ## dim is the output dim of the result dim = dim(tag) if (!is.null(dim(data))) dim = dim(data) if (is.null(data)) data = '' na = length(attrs) ## attributes grid xattrs = NULL if (na>0) { namax = max(sapply(attrs, length)) n = max(c(length(tag), length(data), namax)) xattrs = matrix('', nrow=n, ncol=na) nattrs = names(attrs) for (i in 1:na) { z = attrs[[i]] if (!is.null(z)) { fna = !is.na(z) xattrs[fna,i] = paste(' ',nattrs[i], '=\"', z[fna], '\"', sep='') if (!is.null(dim(z))) dim = dim(z) } } xattrs = apply(xattrs, 1, paste, collapse='') } if (newline) nl = '\n' else nl = NULL res = paste('<', tag, xattrs, '>', nl, data, '', nl, sep='') natag = rep(is.na(tag), length(res)/length(tag)) res[natag] = paste(rep('', length(tag)), rep('', length(xattrs)), data, sep='')[natag] if (!is.null(dim)) res = array(res, dim=dim) res } hwriter/R/table.R0000644000175100001440000002030411473525402013371 0ustar hornikusers## private ## process .row or .col argument on its corresponding rcdata matrix ## location rule: ## - if rowcol named, expand it to dim(data)[kaxis], with first '' to headers ## - if rowcol unnamed of size 1, apply to header ## fill rule: ## - start at first data (not full) cell, if possible ## - recycle is TRUE by default hprocessRowCol=function(rowcol,rcdata,data,axis,ddim,recycle=TRUE) { if (!is.null(rowcol)) { dim=dim(data) if (axis==2) ndata=rownames(data) else ndata=colnames(data) kaxis=3-axis ## named case nrowcol=names(rowcol) if (!is.null(nrowcol)) { if (is.null(ndata)) ndata=c('',rep(NA,dim[kaxis]-1)) rowcol=rowcol[match(ndata,nrowcol)] if (is.list(rowcol)) rowcol=lapply(rowcol,function(z) if (is.null(z)) NA else z) } else { ## special rules to save room for the header: ## - if rowcol has more than one element ## - AND if one row/col has been added in the contraxis ## - AND if length rowcol is different from the contraxis if (length(rowcol)!=1 & dim[kaxis]!=ddim[kaxis] & length(rowcol)!=dim[kaxis]) rowcol=c(NA,rowcol) } for (i in 1:length(rowcol)) { rc=rowcol[[i]] if (!all(is.na(rc))) { if (recycle) rc=array(rc,dim=c(1,max(ddim[axis],length(rc)))) drc=length(rc) j=ifelse(dim[axis]==drc,1,dim[axis]-ddim[axis]+1) if (axis==1) rcdata[j:(drc+j-1),i]=rc else rcdata[i,j:(drc+j-1)]=rc } } } rcdata } ## private ## reindex row or col named vector into a numeric fashion hmapRowCol=function(x,rowcolnames) { if (is.null(x)) y=NULL else { if (is.null(names(x))) y=x else { if (is.null(rowcolnames)) y=NULL else { z=match(names(x),rowcolnames) y=rep(NA,length(rowcolnames)) y[na.omit(z)]=x[which(!is.na(z))] } } } y } ## handles row, col and table arguments hwrite.table=function(data,page=NULL,...,table=TRUE,row.names=T,col.names=T,split.maxncol=NULL,split.maxnrow=NULL,col.width=NULL) { ddim=dim(data) if (!table) { z=hwrite(as.vector(data),table=FALSE,...) dim(z)=ddim return(z) } ## process row and column names (add a col and a row, resp.) acol=row.names & !is.null(rownames(data)) arow=col.names & !is.null(colnames(data)) if (acol) data=cbind(rownames(data),data) if (arow) data=rbind(colnames(data),data) ## ddim is the data dim only (without extra col and/or row) ## dim is the expanded data dim=dim(data) ## filters arguments args=list(...) nargs=names(args) ## table arguments itable=match(substr(nargs,1,6),'table.') iptable=match(nargs,c('cellspacing','cellpadding','width','border')) args.table=args[!is.na(itable)] names(args.table)=substr(names(args.table),7,nchar(names(args.table))) args.table=c(args.table,args[!is.na(iptable)]) ## row arguments irow=match(substr(nargs,1,4),'row.') args.row=args[!is.na(irow)] names(args.row)=substr(names(args.row),5,nchar(names(args.row))) ## col arguments icol=match(substr(nargs,1,4),'col.') args.col=args[!is.na(icol)] names(args.col)=substr(names(args.col),5,nchar(names(args.col))) ## string arguments istring=match(nargs,c('name','heading','center','div','br')) args.string=args[!is.na(istring)] ## td arguments (remaining ones) args.td=args[is.na(itable) & is.na(irow) & is.na(icol) & is.na(istring) & is.na(iptable)] zargs=rep(list(NULL),length(args.row)+length(args.col)) names(zargs)=c(names(args.row),names(args.col)) args.td=c(args.td,zargs) ## expand if needed args.td=lapply(args.td,hexpand,dim,ddim) ## process .row and .cow arguments for (z in names(args.col)) args.td[[z]]=hprocessRowCol(args.col[[z]],args.td[[z]],data,1,ddim) for (z in names(args.row)) args.td[[z]]=hprocessRowCol(args.row[[z]],args.td[[z]],data,2,ddim) ## special case for col.width if (!is.null(col.width)) { width=array(NA,dim=dim) icol.width=hmapRowCol(col.width,colnames(data)) width[1,1:length(icol.width)]= icol.width args.td=c(args.td,list(width=width)) } ## process split.maxncol and split.maxnrow if (!is.null(split.maxncol) | !is.null(split.maxnrow)) { if (!is.null(split.maxncol) & !is.null(split.maxnrow)) stop('either \'split.maxnrow\' or \'split.maxncol\' must be NULL') ## split ancillary tables data=hsplitArray(data,maxnrow=split.maxnrow,maxncol=split.maxncol,preserve.size=T,output.list=F,arow=arow,acol=acol) for (z in names(args.td)) args.td[[z]]=hsplitArray(args.td[[z]],maxnrow=split.maxnrow,maxncol=split.maxncol,preserve.size=T,output.list=F,arow=arow,acol=acol) } do.call(hwriteRawTable,c(list(data,page=page,args.td=args.td,args.table=args.table,args.string=args.string))) } ## private ## expands a to be of size ddb (if possible) and put in a matrix ## of size db, adding top/left NA rows/columns if needed hexpand=function(a,db,ddb) { if (is.null(a)) a=NA if (is.null(dim(a))) a=array(a,dim=ddb) da=dim(a) b=array(NA,dim=db) i=ifelse(db[1]==da[1],1,db[1]-ddb[1]+1) j=ifelse(db[2]==da[2],1,db[2]-ddb[2]+1) b[i:(da[1]+i-1),j:(da[2]+j-1)]=a b } ## private hwriteRawTable=function(data,page=NULL,args.td=NULL,args.table=NULL,args.string=NULL) { ## default arguments if (is.null(args.table[['border']])) args.table[['border']]=1 if (!is.matrix(data)) stop('\'data\' must be a matrix') dim=dim(data) data=as.vector(data) data[is.na(data)]=' ' ## process cell links data=hwrite(data,link=args.td$link,table=F) args.td$link=NULL ## process cells data=do.call(hmakeTag,c(list('td',data),args.td)) ## process rows tr dim(data)=dim data=apply(data,1,function(z) paste(z,collapse='')) data=hmakeTag('tr',data,newline=T) ## process table data=paste(data,collapse='') str=do.call(hmakeTag,c(list('table',data,newline=T),args.table)) ## final do.call(hwrite,c(list(str,page),args.string)) } ## private ## - split an array into a list of subarrays ## - rownames and colnames are ignored ## - arow and acol indicate that the first row (resp col) should be treated as a rowname (resp colname) hsplitArray=function(data,maxnrow=0,maxncol=0,preserve.size=T,output.list=T,arow=F,acol=F) { if (is.null(data)) return(NULL) if (!is.matrix(data)) stop('\'data\' must be a matrix') if (is.null(maxnrow)) maxnrow=0 if (is.null(maxncol)) maxncol=0 if (maxnrow==0 && maxncol==0) stop('splitting must be done in one direction: either \'maxnrow\' or \'maxncol\' must be non null') if (maxnrow*maxncol!=0) stop('splitting cannot be done on both directions: either \'maxnrow\' or \'maxncol\' must be null') if (!output.list && !preserve.size) stop('outputting matrix is possible only if \'preserve.size\' is TRUE') ## preserve first row (resp col) if (arow) { zrow=data[1,] data=data[-1,] } if (acol) { zcol=data[,1] data=data[,-1] } nr=nrow(data) nc=ncol(data) if (output.list) out=list() else out=NULL ## maxncol splitting (horizontal splitting) if (maxncol>0) { nc2=maxncol z1=1 repeat { if (z1>nc) break z2=z1+nc2-1 if (z2>nc) z2=nc if (preserve.size) { napz=nc2-z2+z1-1 zdata=matrix(c(data[,z1:z2],rep(NA,nr*napz)),nrow=nr,ncol=nc2) nap=rep(NA,napz) } else { zdata=matrix(data[,z1:z2],nrow=nr,ncol=1+z2-z1) nap=NULL } if (acol&arow) { zdata=cbind(zcol,zdata) zdata=rbind(c(zrow[c(1,1+(z1:z2))],nap),zdata) } else if (acol) zdata=cbind(zcol,zdata) else if (arow) zdata=rbind(c(zrow[z1:z2],nap),zdata) if (output.list) out=c(out,list(zdata)) else out=rbind(out,zdata) z1=z2+1 } } ## maxnrow splitting (vertical splitting) if (maxnrow>0) { nr2=maxnrow z1=1 repeat { if (z1>nr) break z2=z1+nr2-1 if (z2>nr) z2=nr if (preserve.size) { napz=nr2-z2+z1-1 zdata=matrix(c(t(data[z1:z2,]),rep(NA,nc*napz)),nrow=nr2,ncol=nc,byrow=T) nap=rep(NA,napz) } else { zdata=matrix(data[z1:z2,],nrow=1+z2-z1,ncol=nc) nap=NULL } if (acol) zdata=cbind(c(zcol[z1:z2],nap),zdata) if (arow) zdata=rbind(zrow,zdata) if (output.list) out=c(out,list(zdata)) else out=cbind(out,zdata) z1=z2+1 } } out } hwriter/R/example.R0000644000175100001440000004661412376052042013747 0ustar hornikusersappendExample=function(argument,description,example,df=NULL) { p=file() ## replaces @test by p exampleval=gsub('@test','p',example) z=eval(parse(text=exampleval)) if (!is.null(z)) { z=gsub('<','<',z) z=gsub('>','>',z) write(z,p) } write('\n',p) result=paste(readLines(p),collapse='') close(p) ## replaces @test by test.html example=gsub('@test','\'test.html\'',example) ## escapes linebreaks in HTML description=gsub('\n','
',description) example=gsub('\n','
',example) ## preserves HTML entities example=gsub('&','&',example) description=gsub('\\$<','<',description) description=gsub('\\$>','>',description) ## removes comments example=gsub('## ','',example) if (!is.null(argument)) { argument=gsub('\n','
',argument) z=data.frame(Argument=argument,Description=description,Example=example,Result=result) } else z=data.frame(Description=description,Example=example,Result=result) if (is.null(df)) df=z else df=rbind(df,z) df } writeExample=function(df,p,cw,centerExample=TRUE) { if (centerExample) hwrite(df,p,row.bgcolor='#ffffaa',row.names=FALSE, col.width=cw,class='tab',col.style=c(Example='font-family:monospace',Result='text-align:center'),row.style='text-align:center') else hwrite(df,p,row.bgcolor='#ffffaa',row.names=FALSE, col.width=cw,class='tab',col.style=c(Example='font-family:monospace'),row.style='text-align:center') } showExample=function() { tmpdir = tempdir() filename = file.path(tmpdir,'example-hwriter.html') ## copying data files imgdir=file.path(system.file(package='hwriter'),'images') images=file.path(imgdir,dir(imgdir)) file.copy(images,tmpdir) ## opens webpage write(paste('Building the example webpage',filename,'...'),'') p=openPage(filename,link.css='hwriter.css') cw=c(Argument='100px',Description='400px',Example='350px',Result='300px') hwname=paste('hwriter_',getHwriterVersion(),'.tar.gz',sep='') hwriter=hwrite('hwriter',style='font-family:monospace') ## introduction text=hwrite('The hwriter package',heading=1,center=TRUE) text=c(text,hwriter,' is an easy-to-use package able to format and output R (from the R-project) objects in HTML format. It supports advanced formatting, tables, CSS styling, images, Javascript and provides a convenient mapping between R tables and HTML tables.
') text=c(text,'This is ',hwriter,' version ',getHwriterVersion(),', written by Gregoire Pau. Download ',hwrite(hwname,style='font-family:monospace'),' ',hwrite('here',link=paste('http://www.embl.de/~gpau/hwriter/',hwname,sep='')),' or on ',hwrite('CRAN', link='http://cran.r-project.org/'),'.

') text=c(text,'This page (generated by ',hwriter,') shows examples of the package abilities and illustrates in detail the behavior of the optional arguments used by the function ',hwrite('hwrite()',style='font-family:monospace'),'. All the examples on this page are using the ',hwrite('current',link='hwriter.css'),' CSS stylesheet.') hwrite(paste(text,collapse=''),p,class='intro',div=TRUE) ## 1. Simple examples cw=c(Argument='100px',Description='300px',Example='350px',Result='300px') hwrite(hwrite('1. Simple examples',name='se'),p,heading=1) df=appendExample(NULL,'Writes a string.',"hwrite('Hello world !', @test)") df=appendExample(NULL,'Appends HTML elements in a page.\nWrites a string with an hyperlink.', "## p=openPage('test.html') hwrite('Hello', p, link='http://hello.com') hwrite(' world !', p) ## closePage(p)",df) df=appendExample(NULL,'Writes a vector.',"hwrite(1:5, @test)",df) df=appendExample(NULL,'Writes a matrix.', "hwrite(iris[1:2,1:2], @test, row.bgcolor='#ffdc98')",df) df=appendExample(NULL,'Appends HTML elements in a page. Inserts an image.', "## p=openPage('test.html') hwrite('This is an iris flower:', p, br=TRUE) hwriteImage('iris1.jpg', p, br=TRUE) hwrite('',p, br=TRUE) hwrite(c('Plantae','Monocots','Iris'), p) ## closePage(p)",df) df=appendExample(NULL,'Outputs HTML code part.', "hwrite('Monocots', link='http://mc.org')",df) df=appendExample(NULL,'Combines HTML code parts.', "hwrite(c('Plantae', hwrite('Monocots', link='http://mc.org'), 'Iris'), @test)",df) df=appendExample(NULL,'Combines HTML code parts using nested calls.', "img=hwriteImage('iris3.jpg', center=TRUE) cap=hwrite(c('Plantae', hwrite('Monocots', link='http://mc.org'), 'Iris')) hwrite(c(img, cap), @test, dim=c(2,1), center=TRUE)",df) writeExample(df,p,cw) ## 2. advanced examples hwrite(hwrite('2. Advanced examples',name='ae'),p,heading=1) cw=c(Argument='100px',Description='400px',Example='200px',Result='300px') df=appendExample(NULL,"CSS styling.", "## p=openPage('test.html') hwrite(paste('The fox jumps ',hwrite('over', link='http://over.com'), ' the ', hwrite('red', style='color:#cc3355'), ' wall.', collapse=''), p, br=TRUE) hwrite(paste('The function', hwrite( 'hwrite()', style='font-family:monospace'), 'is cool !'), p) ## closePage(p)") df=appendExample(NULL,"Banner of multisized images, with CSS tiled background and hyperlink."," hwriteImage('iris1.jpg', @test, width=c(50,75,100,125), link=c('http://www.ab1.com', 'http://www.ab2.com', 'http://www.ab3.com', 'http://www.ab4.com'), table.style=' background-image: url(motif.png);background-repeat: repeat')", df) df=appendExample(NULL,paste('Named anchors and customized CSS hyperlinks using classes in the ',hwrite('current',link="hwriter.css"),' CSS stylesheet and margins.',sep='')," ## p=openPage('test.html', link.css='hwriter.css') hwrite('Please select an item:', p, br=TRUE) items=c('Gene', 'mRNA', 'Polypeptide', 'Protein') links=paste('http://en.wikipedia.org/wiki/', items, sep='') hwrite(hwrite(items, class='example', link=links, table=FALSE), p, border=0) sections=c('Simple examples', 'Advanced examples', 'Details') nanchors=c('#se', '#ae', '#de') hwrite(hwrite(sections, class='example2', link=nanchors, table=FALSE), p, dim=c(3,1), style='margin:0px ; padding:8px', table.style='margin-top:20px', border=0) ## closePage(p)",df) df=appendExample(NULL,'Pointing columns and rows. Changing background color, alignments, hyperlinks and CSS style.'," colors=c('#ffaaff','#ddaaff','#bbaaff','#99aaff','#55aaff') hwrite(iris[1:7,1:4], @test, center=TRUE, row.bgcolor=list('#aaffaa', '3'='#ffffaa', '5'=colors), col.style=list(Sepal.Length='font-style:italic',Petal.Length='text-align:center'), row.style=list('font-weight:bold'), col.link=list(Sepal.Width=iris$Sepal.Width[1:7]))",df) df=appendExample(NULL,'Color scale bar.'," scale=round(seq(0, 1, len=8), 2) colors=rgb(colorRamp(c('#ff0000', '#ffff00', '#ffffff'))(scale), max=255) band=hwrite(scale, @test, bgcolor=colors, style='color: black', col.width=rep(20, 8)) ",df) df=appendExample(NULL,"Complex layout using borderless tables.", "img=hwriteImage('iris1.jpg', center=TRUE) cap=hwrite(c('Plantae', hwrite('Monocots', link='http://mc.org'), 'Iris')) iris=hwrite(c(img, cap), dim=c(2,1), center=TRUE, border=0) colors=rgb(colorRamp(c('#7f007f', '#aaaaaa'))(seq(0, 1, len=5)), max=255) band=hwrite(c('+', rep(' ',3), '0'), bgcolor=colors, dim=c(5,1), border=0, style='color: white') hwrite(c(iris,band), @test, border=0)",df) df=appendExample(NULL,"Combining matrix of images and hyperlinking."," himg=hwriteImage(c('iris1.jpg','iris2.jpg','iris3.jpg'), link=c('http://en.wikipedia.org/wiki/Iris_virginica', 'http://en.wikipedia.org/wiki/Iris_versicolor', 'http://en.wikipedia.org/wiki/Iris_virginica'), table=FALSE) mat=rbind(himg, c('Setosa','Versicolor','Virginica')) rownames(mat)=c('Image', 'Species') hwrite(mat, @test, br=TRUE, center=TRUE, row.bgcolor=list(Species=c('#ffaacc', '#ff88aa', '#ff6688')), col.bgcolor='#ffffaa', row.style=list(Species='text-align:center')) ",df) df=appendExample(NULL,'Fancy patchwork. Advanced text formatting.'," cells=matrix('', nr=6, nc=5) hotcolors=rgb(colorRamp(c('#ff0000', '#ffff00', '#ffffff'))(runif(length(cells))), max=255) bgcolor=array(hotcolors, dim=dim(cells)) rownames(cells)=1:nrow(cells) patchwork=hwrite(cells, bgcolor=bgcolor, col.width=rep('16px', nrow(cells))) text='La volupté de la chair est une chose de la vie des sens au meme titre que le regard pur, que la pure saveur d\\'un beau fruit sur notre langue...' text=paste(hwrite(text, br=TRUE), hwrite('Rainer Maria Rilke', style='font-style:italic')) hwrite(c(patchwork,text), @test, br=TRUE, center=TRUE, col.width=c(NA,'200px'), style='text-align:justify', border=0, cellspacing=10) ",df) df=appendExample(NULL,"Sections (divisions) and CSS styling."," ## p=openPage('test.html') codestyle='margin: 10px; padding: 10px; background-color: #aaffaa; border: solid 1px black; font-family: monospace ; text-align: left' hwrite('Please type the following commands:', p) hwrite(paste(hwrite(c('> library(rgl)', '> example(rgl)'), br=TRUE, table=FALSE), collapse=''), p, style=codestyle, div=TRUE) hwrite('to see nice examples of the package rgl.', p) ## closePage(p)",df) df=appendExample(NULL,paste('Styling sections using CSS classes defined in the ',hwrite('current',link="hwriter.css"),' CSS stylesheet.',sep='')," ## p=openPage('test.html', link.css='hwriter.css') text=paste(hwrite('And the king said to her:', class='narrator'), hwrite('What is the matter with you ?', class='king', div=TRUE), hwrite('And she answered:', class='narrator'), hwrite('Give me your son that we may eat...', class='king', div=TRUE), sep='') hwrite(text, p, div=TRUE, class='textbox') ## closePage(p)",df) df=appendExample(NULL,"Use of Javascript through \'onmouseover\' and \'onmouseout\' attributes."," ## p=openPage('test.html') hwrite('Pass the mouse over:', p) hwrite(array(' ',dim=c(6,6)), p, onmouseover=\"this.bgColor='#ffaaaa'\", onmouseout=\"this.bgColor='white'\", bgcolor='white', col.width=rep(18,6), style='padding:0px; margin:0px') ## closePage(p)",df) df=appendExample(NULL,'Build HTML tags using \'hmakeTag\' to render additonal HTML objects.'," ## p=openPage('test.html') hwrite('This is an itemized bullet list:', p) li=paste(hmakeTag('li', c('Abstract', 'Methods', 'Results')), collapse='') hwrite(hmakeTag('ul', li, style='font-weight:bold; text-align:left'), p) ## closePage(p)",df) writeExample(df,p,cw) ## 3. hwrite arguments cw=c(Argument='100px',Description='400px',Example='350px',Result='300px') hwrite(hwrite(paste('3. Detailed description of ',hwrite('hwrite()',style='font-family:monospace'),'arguments'),name='de'),p,heading=1) ## 3.1. general arguments hwrite('3.1. General arguments',p,heading=2) df=appendExample('br','Inserts a carriage return (line break, newline) at the end of the HTML element.', "## p=openPage('test.html') hwrite('The fox ', p) hwrite('jumps', p, br=TRUE) hwrite('over the...', p, br=TRUE) ## closePage(p)") df=appendExample('table','Controls if the object should be written as an HTML table. Default is "TRUE" for vectors and matrices, and "FALSE" otherwise. If set to "FALSE", the object is written as a vector (or a matrix) of HTML elements.', "## p=openPage('test.html') hwrite(1:6, p, br=TRUE) hwrite(1:6, p, table=FALSE) ## closePage(p)",df) df=appendExample('name','Names the HTML element for further reference using hyperlinks.', "## p=openPage('test.html') hwrite(hwrite('Section 1.', name='s1'), p, heading=3) hwrite(c('Go to this ', hwrite('section', link='#s1'), ' or this ', hwrite('one', link='#s2'), '.'), p, table=FALSE) hwrite(hwrite('Section 2.', name='s2'), p, heading=3) hwrite('Another section...', p) ## closePage(p)",df) df=appendExample('link','Adds hyperlink(s) (anchor, hypertext) to the HTML element.', "hwrite('The fox', @test, link='http://www.fox.com')",df) df=appendExample('div','Places the HTML element into a div HTML section, using the $ HTML tag. This is helpful for styling a section.', "## p=openPage('test.html', link.css='hwriter.css') hwrite('In Greek mythology, a cyclops is a member of...', p, div=TRUE, class='king') ## closePage(p)",df) df=appendExample('center','Centers the HTML element. This element may interfere with the current CSS style. Please consider the CSS style attribute \"text-align\" instead.', "## p=openPage('test.html') hwrite('The fox', p, center=TRUE) hwrite('jumps over the...', p, center=TRUE) ## closePage(p)",df) df=appendExample('...','Additional arguments are added to the HTML element as HTML attributes. For HTML tables, attributes are distributed on table cells using R recycling rules. For text elements, a $ HTML tag (or $ if \'div\' is \'TRUE\') is used to accommodate the attributes.', " hwrite(1:3, k=1:2)",df) writeExample(df,p,cw,centerExample=FALSE) ## 3.2. text elements hwrite('3.2. Text element specific arguments',p,heading=2) df=appendExample('heading',paste('Changes the heading level of the HTML element. Heading styles can be modified in the ',hwrite('current', link='hwriter.css'), ' CSS stylesheet.',sep=''), "## p=openPage('test.html') hwrite('Heading 1', p, heading=1) hwrite('Heading 2', p, heading=2) hwrite('Heading 3', p, heading=3) ## closePage(p)") df=appendExample('style\nclass',paste("Uses an CSS style (inline) or a CSS class (defined in the ",hwrite('current', link='hwriter.css')," stylesheet) to render the HTML element. CSS styles are versatile and allow to change the current typeface, color, margins, font, boldness, italic, padding, alignement... See the
W3C reference or this wizard to generate new styles. By default, the style is changed on the fragment of a sentence, using the $ HTML tag. Use the combination with the div argument to change the style of a whole section.",sep=''), "## p=openPage('test.html', link.css='hwriter.css')\n hwrite('The fox ', p, style='font-weight: bold') hwrite('jumps over ', p, style='font-family: monospace;color: #ff2233') hwrite('the wall.', p, style='text-align: right; font-style: italic')\n hwrite('hwriter', p, div=TRUE, style='margin:16px; font-size:150%; text-align:right')\n hwrite('Socrates was a Classical Greek philosopher.', p, class='king', div=TRUE)\n ## closePage(p)",df) writeExample(df,p,cw) ## 3.3 vector hwrite('3.3. Vector specific arguments',p,heading=2) df=appendExample('dim','Sets the dimension of the output HTML table.', "hwrite(1:6, @test, dim=c(2,3))") df=appendExample('byrow','Controls if the output HTML table should be filled by rows first. If set to "FALSE", the table is filled by columns first. Default is "FALSE".', "hwrite(1:6, @test, dim=c(2,3), byrow=TRUE)",df) df=appendExample('names','Controls if the names of a named vector should be shown. Default is "TRUE".', "## p=openPage('test.html') z=c(red=0.5, green=0.6, blue=0.7) hwrite(z, p, br=TRUE) hwrite(z, p, names=FALSE) ## closePage(p)",df) writeExample(df,p,cw) ## 3.4. table hwrite('3.4. Matrix/table and vector specific arguments',p,heading=2) df=appendExample('border',"Specifies the table border width. A value of 0 implies that no borders will be drawn. This argument may interfere with the \'border\' CSS style attribute.", "hwrite(iris[1:4,1:2], @test, border=0)") df=appendExample('row.names\ncol.names','Specifies if the row (resp. column) names should be displayed.', "## p=openPage('test.html')\n hwrite(iris[1:2,1:2], p, br=TRUE, row.names=FALSE)\n hwrite(iris[1:2,1:2], p, br=TRUE, row.names=FALSE, col.names=FALSE)\n ## closePage(p)",df) df=appendExample('cellspacing\ncellpadding',"Defines the padding and spacing space in pixels between cells. These arguments may interfere with the \'border\' and \'padding\' CSS style attributes.", "hwrite(iris[1:2,1:2], @test, center=TRUE, br=TRUE, row.bgcolor='#ffaaaa', cellspacing=10, table.class='raw') ",df) df=appendExample('width\ncol.width',"Defines global table width and column widths in HTML units (pixels or %).\n'width' specifies the table global width.\n'col.width' contains either a vector of widths (of size equals to the number of columns) which may contain NAs or a named vector of widths which point to some column names.", "## p=openPage('test.html')\n hwrite(iris[1:2,1:2], p, br=TRUE, width='150px', row.names=FALSE, col.names=FALSE)\n hwrite(iris[1:2,1:2], p, br=TRUE, col.width=c(Sepal.Length='150px'))\n ## closePage(p)",df) df=appendExample('style\nclass\nbgcolor\nlink\n...',"Distributes an attribute on table cells, using R recycling rules. 'style' and 'class' distributes the HTML CSS styling attributes, 'bgcolor' distributes the background color HTML attribute but any valid HTML attribute can be used. Value of the attribute could be either a character vector or a matrix and may contain NAs to omit cells. Matrices may contain one extra row and/or column to target heading cells.", "## p=openPage('test.html')\n hwrite(iris[1:2,1:2], p, br=TRUE, style=matrix(c(NA, 'color:#ff0000', 'color:#0000ff; font-style:italic; text-align:right', NA),nr=2,nc=2))\n hwrite(iris[1:2,1:2], p, br=TRUE, bgcolor=matrix(c('#aaffaa', NA, '#ffffaa', '#ffffff','#aaaaff', NA),nr=3,nc=2))\n hwrite(1:4, p, br=TRUE, bgcolor=c('#66ffff', '#99ffee', '#ccffdd', '#ffffcc'), link=1:4)\n hwrite(array(1:20, dim=c(4,5)), p, br=TRUE, bgcolor=c('#ffffff', '#ffbbaa', '#ff9977', '#ffbbaa', '#ff5500'), link=matrix(1:4, nr=2, nc=2))\n ## closePage(p)",df) df=appendExample('row.style\ncol.style\nrow.bgcolor\ncol.bgcolor\nrow.link\ncol.link\nrow.*\ncol.*',"Distributes an attribute on table cells, according to row/columns. The argument may contain a list of vectors of values or a vector of values. Named lists (or vectors) point the corresponding rows/columns, according to their names. Unnamed lists (or vectors) point the rows/columns in the numeric order and NAs can be used to omit rows/columns. If sizes don't match, values are recycled using R rules.", "## p=openPage('test.html')\n hwrite(iris[1:2,1:2], p, br=TRUE, row.bgcolor='#ffffaa')\n hwrite(iris[1:2,1:2], p, br=TRUE, row.style=list('font-weight:bold'), col.style=list(Sepal.Length = 'text-align:left; color:#aa0000'))\n hwrite(iris[1:3,1:2], p, br=TRUE, col.bgcolor=list(Sepal.Width=c('#66ffff', '#99ffee', '#ccffdd', '#ffffcc')), row.link=list(NA, c('a', 'b'), NA))\n ## closePage(p)",df) df=appendExample('table.style\ntable.class\ntable.*',"Uses a global table attribute to render the HTML table. The attribute is added to the main $ tag and should contain a single value. Some uses include setting of the CSS 'border' and 'margin' attributes that cannot be distributed on cells.", "## p=openPage('test.html')\n hwrite(iris[1:2,1:2], p, br=TRUE, table.style='font-family: monospace ; border-spacing: 5px; border-collapse: collapse; background-color: white')\n hwrite(iris[1:2,1:2], p, br=TRUE, table.frame='void')\n ## closePage(p)",df) writeExample(df,p,cw) closePage(p) ## open browser write(paste('Opening a web browser on', filename, '...'),'') if (interactive()) try(browseURL(paste("file://", filename, sep = ""))) write("OK. A web page showing all the examples should have been opened.",'') } hwriter/R/page.R0000644000175100001440000000366212376052145013230 0ustar hornikusers## page related functions openPage=function(filename, dirname=NULL, title=filename, link.javascript=NULL, link.css=NULL, css=NULL, head=NULL, charset="utf-8", lang="en", head.attributes=NULL, body.attributes=NULL) { if (!is.null(dirname)) { if (!file.exists(dirname)) dir.create(dirname, recursive=TRUE, showWarnings=FALSE) filename = file.path(dirname, filename) } page = file(filename,'wt') doctype = '\n' meta = hmakeTag('meta',NULL,'http-equiv'='Content-Type',content=paste("text/html; charset=", charset, sep=''), newline=FALSE) if (!is.null(link.javascript)) link.javascript = paste(hmakeTag('script', language='JavaScript', src=link.javascript), collapse='\n') if (!is.null(link.css)) link.css = paste(hmakeTag('link', rel='stylesheet', type='text/css', href=link.css), collapse='\n') if (!is.null(css)) css = paste(hmakeTag('style', css), collapse='\n') head = paste(meta, hmakeTag('title',title), head, link.javascript, link.css, css, sep='\n') head = do.call(hmakeTag, c(list('head', head, newline=TRUE), head.attributes)) bodyStart = do.call(hmakeTag, c(list('body', NULL), body.attributes)) bodyStart = substr(bodyStart, 1, regexpr('', bodyStart)-1) hwrite(paste(doctype, "", head, bodyStart, sep=''), page) page } getHwriterVersion=function() { (sessionInfo()$otherPkgs)[['hwriter']]$Version } closePage=function(page, splash=TRUE) { hwriterlink = hwrite('hwriter', link='http://www.embl.de/~gpau/hwriter/index.html') if (splash) hwrite(paste('\n

(Page generated on ', date(), ' by ', hwriterlink, ' ', getHwriterVersion(), ')', sep=''), page, br=TRUE) else hwrite('\n

', page, br=TRUE) hwrite('', page, br=FALSE) close(page) } hwriter/MD50000644000175100001440000000230214224012707012260 0ustar hornikusers20dc1f80585a1fb471910ea9916878b7 *CHANGES d8ce76c44e9d1c2cad2e335049906480 *DESCRIPTION 7b723fe2a1cfd0457d213bff5dfb9ee2 *NAMESPACE 512b7926dbec0e46f82202d2c21407df *R/example.R 2c50a111830850d99f808d540e51dd2b *R/hwriter.R 50f1a547e6099eba1456a6871b40cafe *R/page.R 3f14c04b3d1b66d785219ac0f224f479 *R/table.R 8112c0ff3312637dbdc1a46f72452087 *TODO c6e14eb80fddcd55a36ae5a606b01335 *build/vignette.rds 8fc0302ea00305bfb331e20312f94758 *inst/doc/hwriter.R dd5aefebaa44ad59ca80da496a71886f *inst/doc/hwriter.Rnw bcfe799a4a88932ec17acb5b82b88b8e *inst/doc/hwriter.pdf a5bd1a6bd2445616817da1beef6cc06e *inst/images/hwriter.css 5ae0289b1f93ed9f135851cb93d66fde *inst/images/iris1.jpg a20525b70f7238568257e03399fbe77d *inst/images/iris2.jpg f8702b42db632716d9dcce5314d0e7ff *inst/images/iris3.jpg 31d68e85d2d872e8eeb6f071d84abf9d *inst/images/motif.png 3d195a1fdbe2c368a8ea0eed8862446e *inst/scripts/build.sh b1be682a81f0212896eb59ffd56048aa *man/hmakeTag.Rd 0e3437193e043fa7424c7a7085ac537b *man/hwrite.Rd 2db9472c0e65d9c0b95405ed1925296c *man/hwriteImage.Rd 9494fe35e5be12a31a43fd18303c556e *man/hwriter-package.Rd 07bb9bd51103bf3eeec939c226e412be *man/openPage.Rd dd5aefebaa44ad59ca80da496a71886f *vignettes/hwriter.Rnw hwriter/inst/0000755000175100001440000000000011473677035012746 5ustar hornikusershwriter/inst/doc/0000755000175100001440000000000012376054107013503 5ustar hornikusershwriter/inst/doc/hwriter.R0000644000175100001440000000034014224007240015275 0ustar hornikusers### R code from vignette source 'hwriter.Rnw' ################################################### ### code chunk number 1: example ################################################### library('hwriter') example('hwriter') hwriter/inst/doc/hwriter.Rnw0000644000175100001440000000341411473525402015657 0ustar hornikusers% \VignetteIndexEntry{Description of the package hwriter} % \VignetteKeywords{HTML, hwriter} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{hyperref} \clearpage \parindent 0in % Left justify \newcommand{\Rpackage}[1]{\textsf{#1}} \newcommand{\Rfunction}[1]{\textit{#1}} \newcommand{\Robject}[1]{\texttt{#1}} \newcommand{\Rclass}[1]{{\textit{#1}}} \newcommand{\Rmethod}[1]{{\textit{#1}}} \newcommand{\Rfunarg}[1]{{\textit{#1}}} \SweaveOpts{eps=FALSE} \title{The hwriter package} \author{Gregoire Pau} \begin{document} \maketitle \section{Description} The package \Rpackage{hwriter} is an easy-to-use package able to format and output R (from the R-project) objects in HTML format. It supports advanced formatting, tables, CSS styling, images and provides a convenient mapping between R tables and HTML tables. The project page is \url{http://www.ebi.ac.uk/~gpau/hwriter}. The package provides the following functions (but most of the job is carried out by \Rfunction{hwrite}): \begin{itemize} \item \Rfunction{hwrite} outputs an R object in HTML format. \item \Rfunction{hwriteImage} writes an image. \item \Rfunction{openPage, closePage} handles HTML page/document creation. \item \Rfunction{hmakeTag} is a low-level HTML tag formatting function. \end{itemize} All the functions are documented in the manual pages. Please check them for reference. \section{Example} It is not easy to render what an HTML writing package could do in a PDF document. The following example produces a local web page named \Rfunction{example-hwriter.html} which contains many documented examples, all with R sources and resulting HTML outputs. % <>= library('hwriter') example('hwriter') @ % \end{document} hwriter/inst/doc/hwriter.pdf0000644000175100001440000006122214224007240015653 0ustar hornikusers%PDF-1.5 % 1 0 obj << /Type /ObjStm /Length 1998 /Filter /FlateDecode /N 30 /First 221 >> stream xYYs6~[Tyt2/Ŏ8ݤ䁑`L$9}o.xd$,#8.QD8h"9'Q'.\8%r8 &@rA-`:~ a${D*30|0Lr}XPjLaI>ҴKO8LB+~zбɂyD wlF&]M '@Ȳe/a$1AiWض`y\_WL%~sܚdfKIbayjy!v7I<_ \2NtZL_4r ZxeD! yu.rQgH (N(3tʼ D;  $ ,:1iNf9Ǹb66 8ЛsXyʀQ}QmI>-^]}NMUV*ojvJr7)Jx\%Gustx BVМ&1}6W{0أ3gvfj 5Vr|=d<Cg,тa4paz Fh˶8(s` EK ~18EȮ<}CF|lyv R,jә07&\,1h’i/- Kү&4VI_a`۰9.nY>Hm:x0m_W ghz4[)g߈XXlH){;eźZm-se bo K{B:"\+GUGblԲ5x[ Q6HXFI]~\ 5Wg[bRXFY.Wu$ =tD zEN" `tb-zo di"}i#ZbszJU.&knN6Iܰ+P vimMd+x6~si~ T XO+-sn1{C W*\۝[iu";Iג~Q.者өc3l꩎#LR0m9(r(jj' M= #مd4<ɦޔ3AS Hº6A| Ї͵(TGc"wWs kɰmP#Lv{Ÿ1|мLVֶkRֿhn[w=Cik#=a}'J& ncp(o!w%Hgax2I=mc_WżF~d3|7ׁ҅}mO54{r#p?k]]oߎpF!pI̖?h;,j3x g{e5"l$d@N DlTg(d姊 9png^k$+*<@$uׄE+¢`^7o")T\?BiWKl>gt RT?=C|J^r_ގs qOȦ䧑=I@;vE|a ph{>n週w r:޶s`C[`}*;@i_uƎxtE>Mmȶ6:y6n./VnLui+Qs[g4r)Oy˃^"R endstream endobj 32 0 obj << /Subtype /XML /Type /Metadata /Length 1387 >> stream GPL Ghostscript 9.55.0 2022-04-08T12:29:52+02:00 2022-04-08T12:29:52+02:00 LaTeX with hyperref endstream endobj 33 0 obj << /Filter /FlateDecode /Length 2809 >> stream xZKs Wq6;RJ"΁IkIҒ.9g@3KVJ n_W+wgju}뙦UnٳWQ}Ư2_lj{wS]ީnSeknJo",kbaS2u8cw>gmwo@⠝b:Mؽe.o^ȚSw79(Yi[ lCXm]z[=mƔ4Ƞ]`Kdd 0 sc|o`Kd@#xրđT<89N`r!8_m]f\}6m{>fWiۮTrc?zVsvجl7L6*HpfVlRA:fpȍE皒cBZkT]2C Nl|,,}A-2i?KoynkcsmM͎Hy+hk_P4 h_/ Tu8Q iǠ7) ![&KXҌr40Tj79/E>MDQE2kǔu99zA6 C175reu|lÚipk#38G؋!:tqd:NC"CHzkP hS9Jh|>Fn4r#U a<=,ۣ8W{ jަ.!llISקzbR<[0Ԩq@MQ-!J}1AB$~ޮ=U(x/.В~ y~KQ Ib67<[S sP8j~\(&X1hdS+7l([e`5 +fVl248elQD8vIΧkEa%ԑ8D,qZׯ2%הf &[LQ.3YPɢKbvËٮ &aQB}mglq& x+76"v6_ѭu';9/4֐T#0K[ӡӛ"KM1/ &%`ó(|9>LzJ0 :tXr' %3qTJ4{!Hvgs֡'%~\YTP@6@gxSvoU.3LZPlqVw2y֝1,|*a[e5h`wY9 6N0"Z͜$vRxrB< _ޖ$Of";R'=f7q%ƦD?K~&hu J q]Cm_ᓍ tzcu@^J"b$9m_*A8c(:.#Z͆Q5KpGo"o%[0)r_Q4HW^ N mw0{pgI0P+Zx~v .USf=_h7R7l֢uZDV;zefh`0NG0 p|}|*IC;<Әŋ[@|A|-=#ZqXˣR wGchџwe&T-6CɬăRZzsx-mjً:~Cq4ߩ;U֐'9r('s*_)<\/endstream endobj 34 0 obj << /Filter /FlateDecode /Subtype /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z'a  C *_%_) 9*W7W^tjCffbZZCTcC( -{ KRAjnZwN3>CDtu^GU%7z 1qZb[Bl?3Qvح K%-Ξ^"-Ƀ*l6YIF iaaHendstream endobj 40 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 189 >> stream xcd`ab`dd v 5420q~H3aÏew+o_ 0012:)槤)& 2000v00tgtgvBWլuVкǟ> stream xVM0W֤RqlC~*JO=VX`I`%+tl -qDWɫ4+s"!ea FL$\$r$F~i&9m;xP|Iцs_a4FqZh]خFVt Fk8 *+ҝxKÀ=q2wSB*Sf7H儁4Cj7d!l0'f0&P`Iz!kö.E˫" I[EWr:- `ȽҦ'#؞a0F6MOQg]HXb'PQY-!5A,Q:s+Jgʆu.tهL|a_h(f'!mB{β e'6\|wǿ'j8>[wʝϰhkrvqn}k_70N$=`g?[vVްO=aFv7DxP- t3/?l ?D܄ݝWk^sS:ۅzo+ui[ %W]VG}$Uendstream endobj 42 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1667 >> stream xT{p4u <(`6Cy:CJ[*"*`6M6٦MHMk4M&6iNdD,Ve0^qW˜u3MӚ?;g|""5Diy/:+_( Ot1FѥgAbHWeUD/[X&[~5YYeOJ!Z>dBWɖn,V2 +,WyrA/Q+JelvJ4/Z[Wr|HiJY*So^ v^%b %^&;|b'i,b@H%)tJ7fTǨbjwm#|s1*>b$\ݍQzLd93~IPZ';](}{|TP~86SDPõWGO rz_.&VyP@ ]ژxR@Z F=@~hG[ТvcgL&h7.)Tn s$GxJ6&l*ppezݥZfz*fG54C}憫՟?to i*-6.5lǃj=d[pPٔI;mj >O:).T`؏º :h!;|H&Cq靻[<y6h< A( Ɛ{n[,8kc>4&"^'bؤ m0tkyځ](ex&FpW0{Tb}}'?@'м֤BP-*fE'bn&k?oN{t$-^ŏ G 3%L3)Oc]5.hM$wq_w"`,n p%r7㏍h>_)7-Px6nP;e܋(uVՙ ZMy7W;wtڣV_AiBE=1qtTHk@F-ފY8Cx_oD$h*MFWQt0]%}}46S6yeRhnɿ)(}?w[10juN6ЌC+f:zNCwWmw}]:KT__#ltP3*K΍%Իh"#31v1 joH/a&͝1ΥE1$\omX}TЦ#@b!/~N;'>Ox@;h朂B*?U*VoZKzay _!+__ zDJ;=#uV|)X7xk8b3Y*Ho#n/Y!9{%hh>|͈Rc>#5oU(p~/eKv $K}+ZKM׻clSoe~܍S`+> stream xcd`ab`dd v 1420qH3a!eH3 0012*9)槤)TeDsJRST000030d{gb*e?}QOѬրΦFɵVN3yݔmSM?҂} f5L4tsbfO endstream endobj 44 0 obj << /Type /XRef /Length 73 /Filter /FlateDecode /DecodeParms << /Columns 4 /Predictor 12 >> /W [ 1 2 1 ] /Info 3 0 R /Root 2 0 R /Size 45 /ID [<07a0cf0b038feadb4bdbd9d4f1d82756>] >> stream xcb&F~ cTL l{NvlӁW $_ ^`O]W_q endstream endobj startxref 24890 %%EOF hwriter/inst/images/0000755000175100001440000000000011473677035014213 5ustar hornikusershwriter/inst/images/iris2.jpg0000644000175100001440000000647411473525402015746 0ustar hornikusersJFIFC     "" $(4,$&1'-=-157:::#+?D?8C49:7C 7%%77777777777777777777777777777777777777777777777777}_"8!1A"Qaq2#B$3Rb'!1A"aq#2Q ?f!Q0;8 %d9Z/xI]X(H+H] SX7e>#p>E]a#A\MU0Z LT*sַ2UQEӝVq4Lf'" LH9:2G">{vdqHƾ__FHid|Z?n;|]>+;%()#.ctTAxښY7#:YZ[cn6;*RDd|&d ۾Bv'ȑM@y]pqwGЙx+hbu2b]Qva$@=7tȚdf-"ȀN)zC^EŃ&? "j{pA?/ڷlD GM7%zZ"yoҫd ګg8{|AQ@f#%]$ [\H$,ұtI C#X"CD|[)xlsƃ@Q 6Վ B Pc-:ѫIU8vo6wQ/m%z EC{ m0Qf2C& .a>H#ӛY NzT`HgU&f8r6)n~dEܢ{U4<,p.lesxȁTަFuNr|ibQ2Cv,iRY{OdZZxL3`VEpI<be`dV$-og 4nG|SZKRʄϞ[mUy!R.x5q / hO8;q]F}2|lc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oR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FPLTE\ZάtRNS@*IDATx ,&&IENDB`hwriter/inst/images/hwriter.css0000644000175100001440000000252711473527156016415 0ustar hornikusersbody { padding-top: 10px; padding-left: 5%; padding-right: 5%; font-family: Palatino; background-color: #ffffff } table { border-collapse: collapse; margin-left: auto; margin-right: auto; background-color: #f6f6f6; border-color: gray } table td { padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-color: gray } .intro { background-color: #fff4f4; border: 1px solid; padding: 10px } .textbox { text-align: left; background-color: #c0c0ff; padding: 5%; margin-left:30px; margin-right:30px } a.example:link {color: black; text-decoration: none; border: solid black 1px; padding:4px; background: white} a.example:visited {color: black; text-decoration: none; border: solid black 1px; padding:4px; background: white} a.example:hover {background:#ffdc98} a.example2:link {color: black; text-decoration: none; border: solid black 1px; padding:4px; background: white} a.example2:visited {color: black; text-decoration: none; border: solid black 1px; padding:4px; background: white} a.example2:hover {background:#c0c0ff} .king { margin-left: 10px; margin-top:4px; margin-bottom:4px; padding-left: 10px; padding-top: 3px; padding-bottom: 3px; background-color: white; border: solid 1px black; font-style: italic; text-align: left } hwriter/inst/images/iris1.jpg0000644000175100001440000001255611473525402015743 0ustar hornikusersJFIFC     "" $(4,$&1'-=-157:::#+?D?8C49:7C 7%%77777777777777777777777777777777777777777777777777"8!1AQ"aq2BR#3bSr$!1A"Qa# ?K00}*)^|P]utƇCQy cQ(@u_uZi^ǡm3:Zʇ 4O bl-ۛ_ JI 0[;vUQLE&Ej~Yh^F=SjSR dj]@EBArvf;v솜UAOK:Ɩ7* ƌsb l=}Ksⱹ}b%|߰pSK jR߀M,`3E`ʿ8bhj9pdq`JxJxmj1V7MWC}82,amZ\42 諸Z y, Mj-a|I':t]SUTUU[utCbB^1ŕ&KEJңEVöicYVKp ž]pXFKe yr=$jo uazN#Q呔XYV?-%a0ۃlOsU#XSlxS*)%<3KC?yLH@پh寗$qܛ/F_)Ek(?V!;!w?]2NҪ7Vs`1%MWs`]cm S*ENb| LrQ!,yqǕ:;RJZ))8˚`xVVi78[|7d+DMn.tMZ]\{*rTo51#yElZ(_.z|zATc܏&iw0Fn. t}ХR!U ~{9$Od_nGQ2bd;oh$]r0`ӅtST i&pl> Y]juTkcf;\|&NL4QQ{ktDS cf(TM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l-:SH ,CA7-'AIh]!z ʒL*aHmiz:*e@/\m8a@/iOGTBr-=CAҖ ^w7[ܞ~ ; B5k7Q7b)Leka&{Q4IaKA=+@zEԽL4C=(IQB@G~AJ"rtvr9J "j)hSr;l\.<;h!#_3[?l1hwriter/inst/scripts/0000755000175100001440000000000011473677035014435 5ustar hornikusershwriter/inst/scripts/build.sh0000755000175100001440000000105511473525402016062 0ustar hornikusers#!/bin/sh rm -rf hwriter.Rcheck .Rhistory ..Rcheck example-hwriter.html inst/doc/hwriter.pdf hwriter*.tar.gz article R CMD build . R CMD check hwriter*.tar.gz rm -rf hwriter.Rcheck R CMD INSTALL . echo "library(hwriter) ; example(hwriter) ; file.copy(file.path(tempdir(),'example-hwriter.html'),'.',overwrite=TRUE)" | R --no-save --vanilla scp -P 6422 hwriter_1.2.tar.gz gpau@localhost:~/public_html/hwriter scp -P 6422 example-hwriter.html gpau@localhost:~/public_html/hwriter/index.html rm -rf hwriter.Rcheck .Rhistory ..Rcheck inst/doc/hwriter.pdf hwriter/CHANGES0000644000175100001440000000245211473525402012755 0ustar hornikusersversion 1.3: - links containing NA values are not translated to empty tags anymore - added head.attributes and body.attributes in openPage() - example(hwriter) now uses file:// when calling browseURL to prevent page opening problems - hmakeTags now handles NA tags correctly (no tags) version 1.1: - example-hwriter.html contains now valid XHTML 1.0 code version 1.0: (CRAN) - major release - before: automatic 'style', now: 'table.style' and 'style' - no NA anymore in default arguments - extra attributes *, row.*, col.*, table.* are now consumed - div sections - nice example with CSS stylesheet - wiki attribute removed - name anchor version 0.95: - fixed bug on rowcol naming - fixed bug on class, id and onClick support version 0.94: - hwrite uses table.style instead of style for styling - new logic for rowcol processing - hwrite supports table.class, table.id and table.onClick - hmakeTag supports matrices - hwrite supports class, id and onClick arguments - openPage supports CSS and Javascript - hwrite supports the 'table' argument for single element vectors version 0.93: (CRAN) - remove splash - writeCells removed - simpler doc version 0.92: - pstrick removed from Rnw - fixed width table - openPage head - inst/images + system.file to load images - hwriteImage with vector url.image