Export to HTML tables {GCDkit}R Documentation

Export to HTML tables

Description

Outputs the specified data with (optional) labels into HTML. This format is useful for importing into spreadsheets, word processors or publishing on the WWW.

Usage

    HTMLTableMain(what,digits=2,desc=NULL,title=" ",sum.up=FALSE,open=TRUE,
    close=TRUE,filename=paste(data.dir,"R2HTML/htmltable",sep="/"),rotate=FALSE)

    HTMLtableOrdered(what,which=rownames(what),labs=labels,digits=2,desc=NULL,
    title=" ",sum.up=FALSE,key1=NULL,key2=NULL,
    filename=paste(data.dir,"R2HTML/htmltable",sep="/"),split.by=25,rotate=TRUE) 

    HTMLTableWR(filename="htmltable")

    HTMLTableResults(filename="htmltable")

Arguments

what

numeric matrix; data to be exported

digits

required precision

desc

name of the columns within 'labels' to be attached to the table

title

main title

sum.up

logical; should be a sum calculated?

open

logical; should be opened a new HTML file?

close

logical; should be the HTML file closed when finished?

filename

optional name for the file produced

rotate

logical, should be the table transposed, with samples in columns and variables in rows?

which

(optional) sample names in numeric matrix 'what' for the output

labs

name of variable with textual labels

key1

is a variable in numeric matrix 'what'

key2

is a grouping information (name of a column in 'labs')

split.by

maximal number of data columns per page

Details

HTMLTableWR and HTMLTableResults are GUI front ends to HTMLTableMain, the former enabling the user to choose samples (rows) and columns for the output using the searching mechanisms common in the GCDkit.

HTMLTableWR outputs the numeric data (with optional labels and sum) stored in the data matrix 'WR'.

HTMLtableOrdered also outputs the numeric data stored in the numeric matrix specified by parameter 'what'. Optional argument 'which' gives the list of sample names (rows) in the matrix to be saved. The data are first sorted based on 'key2', which typically gives a grouping information (name of a column in 'labs'). Within each of the groups, the data are further sorted based on the numeric variable 'key1'. See example.

HTMLTableResults outputs the results of the most recent calculation (with optional labels and sum) as stored in the variable 'results'.

The plugin attempts to format sub- and superscripts in the names of variables.

The created file 'filename' is placed in the subdirectory 'R2HTM' of the current working directory; when finished, it is previewed in a browser. The style for the table is determined by the cascade style file R2HTML.css in the subdirectory 'Plugin'.

htmltable.png

Value

None.

Warning

The plugin uses R2HTML library, which must be downloaded from CRAN and properly installed. Its presence is checked before the code is executed.

Author(s)

The R2HTML package was written by Eric Lecoutre.

Vojtech Janousek, vojtech.janousek@geology.cz

Examples

# Works on the 'sazava' test data set
setwd(paste(gcdx.dir,"Test_data",sep="/")) 
loadData("sazava.data")

HTMLTableMain(WR[,c("SiO2","MgO","FeOt")],digits=2,desc="Intrusion",title="Sazava [wt.%]")

HTMLtableOrdered(WR[,LILE],digits=1,key1="SiO2",key2="Intrusion",title="Large Ion Lithophile
    Elements (ppm)",split.by=3)

[Package GCDkit version 4.1 Index]