the size of the border around the table. Could be 0,1,... but also NULL
innerBorder
the size of the border inside the table - see details
classfirstline
CSS class for the first line (header - variable names)
classfirstcolumn
CSS class for the first column (rownames)
classcellinside
CSS class for others cells
append
logical. If 'TRUE' output will be appended to 'file'; otherwise, it will overwrite the contents of 'file'
align
alignment to be used: center, left or right
caption
optional caption to append to the table
captionalign
alignment to be used for the caption: could be bottom or top
classcaption
CSS class to use for caption
classtable
CSS class to be used for the whole table (in html <table> statement)
digits
number of digits to use for rounding
nsmall
number of digits which will always appear to the right of the decimal point in formatting real/complex numbers in non-scientific formats. Allowed values '0 <= nsmall <= 20'
big.mark
character; if not empty used as mark between every 'big.interval' decimals before (hence 'big') the decimal point
big.interval
see 'big.mark' above; defaults to 3
decimal.mark
the character used to indicate the numeric decimal point
sortableDF
See details
row.names
logical. If 'TRUE' row.names are shown in the output; otherwise they are omitted
...
...
Details
For the moment, HTML.matrix and HTML.data.frame do have the same options.
Tables are build using two different HTML tables, one beeing encapsulated within the other, which allows to have a table without borders inside but with a border outside. It is nevertheless recommended to rely on CSS to obtain such results...
Now format is called to format numerical values (modif. suggested by Arne Henningsen). The corresponding arguments are: digits, nsmall, big.mark, big.intervall and decimal.mark. For each argument, one can supply either a single value or a vector. In the second case, the size of the vector has to be the number of columns of the data.frame and formatting options will be used element-wise (column by column).
Some options are used to pass default values.
You can see those options with (by example):
getOption("R2HTML.format.decimal.mark") and options("R2HTML.format.decimal.mark"=",")
Sortable data.frame uses a DHTML behavior. This requires the file ‘tablesort.htc’ which comes with R2HTML to be placed in the same directory than the output. This functionality only works for HTML files located on a web server (not on local computer).
Value
no value returned.
Author(s)
Eric Lecoutre
See Also
HTML
Examples
tmpfic=HTMLInitFile(tempdir(),CSSFile=system.file("samples", "R2HTML.css", package="R2HTML"))
data(iris)
HTML(as.title("Fisher Iris dataset"),file=tmpfic)
HTML(iris, file=tmpfic)
# File is generated, you can call the browser:
## Not run: browseURL(tmpfic)
# Export one line of iris using default decimal separator
HTML(iris[1,],file="")
# Seeing default decimal separator:
getOption("R2HTML.format.decimal.mark")
# Modifying it:
options("R2HTML.format.decimal.mark"=",")
HTML(iris[1,],file="")
# Bypassing value set in option:
HTML(iris[1,],file="",decimal.mark="*")
# Using a vector for formatting options
HTML(iris[1:2,1:2],nsmall=c(3,1),file="")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(R2HTML)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/R2HTML/HTML.data.frame.Rd_%03d_medium.png", width=480, height=480)
> ### Name: HTML.data.frame
> ### Title: Write a data.frame (or matrix) to a HTML output
> ### Aliases: HTML.data.frame HTML.matrix
> ### Keywords: datasets IO
>
> ### ** Examples
>
> tmpfic=HTMLInitFile(tempdir(),CSSFile=system.file("samples", "R2HTML.css", package="R2HTML"))
> data(iris)
> HTML(as.title("Fisher Iris dataset"),file=tmpfic)
> HTML(iris, file=tmpfic)
> # File is generated, you can call the browser:
> ## Not run: browseURL(tmpfic)
>
> # Export one line of iris using default decimal separator
> HTML(iris[1,],file="")
<p align= center >
<table cellspacing=0 border=1>
<caption align=bottom class=captiondataframe></caption>
<tr><td>
<table border=0 class=dataframe>
<tbody>
<tr class= firstline >
<th> </th>
<th>Sepal.Length </th>
<th>Sepal.Width </th>
<th>Petal.Length </th>
<th>Petal.Width </th>
<th>Species</th>
</tr>
<tr>
<td class=firstcolumn>1
</td>
<td class=cellinside>5.1
</td>
<td class=cellinside>3.5
</td>
<td class=cellinside>1.4
</td>
<td class=cellinside>0.2
</td>
<td class=cellinside>setosa
</td></tr>
</tbody>
</table>
</td></table>
<br>
>
> # Seeing default decimal separator:
> getOption("R2HTML.format.decimal.mark")
[1] "."
>
> # Modifying it:
> options("R2HTML.format.decimal.mark"=",")
> HTML(iris[1,],file="")
<p align= center >
<table cellspacing=0 border=1>
<caption align=bottom class=captiondataframe></caption>
<tr><td>
<table border=0 class=dataframe>
<tbody>
<tr class= firstline >
<th> </th>
<th>Sepal.Length </th>
<th>Sepal.Width </th>
<th>Petal.Length </th>
<th>Petal.Width </th>
<th>Species</th>
</tr>
<tr>
<td class=firstcolumn>1
</td>
<td class=cellinside>5,1
</td>
<td class=cellinside>3,5
</td>
<td class=cellinside>1,4
</td>
<td class=cellinside>0,2
</td>
<td class=cellinside>setosa
</td></tr>
</tbody>
</table>
</td></table>
<br>
>
> # Bypassing value set in option:
> HTML(iris[1,],file="",decimal.mark="*")
<p align= center >
<table cellspacing=0 border=1>
<caption align=bottom class=captiondataframe></caption>
<tr><td>
<table border=0 class=dataframe>
<tbody>
<tr class= firstline >
<th> </th>
<th>Sepal.Length </th>
<th>Sepal.Width </th>
<th>Petal.Length </th>
<th>Petal.Width </th>
<th>Species</th>
</tr>
<tr>
<td class=firstcolumn>1
</td>
<td class=cellinside>5*1
</td>
<td class=cellinside>3*5
</td>
<td class=cellinside>1*4
</td>
<td class=cellinside>0*2
</td>
<td class=cellinside>setosa
</td></tr>
</tbody>
</table>
</td></table>
<br>
>
> # Using a vector for formatting options
> HTML(iris[1:2,1:2],nsmall=c(3,1),file="")
<p align= center >
<table cellspacing=0 border=1>
<caption align=bottom class=captiondataframe></caption>
<tr><td>
<table border=0 class=dataframe>
<tbody>
<tr class= firstline >
<th> </th>
<th>Sepal.Length </th>
<th>Sepal.Width</th>
</tr>
<tr>
<td class=firstcolumn>1
</td>
<td class=cellinside>5,100
</td>
<td class=cellinside>3,500
</td></tr>
<tr>
<td class=firstcolumn>2
</td>
<td class=cellinside>4,900
</td>
<td class=cellinside>3,000
</td></tr>
</tbody>
</table>
</td></table>
<br>
>
>
>
>
>
> dev.off()
null device
1
>