Learn R Programming

R2HTML (version 2.3.4)

HTML.cormat: Write a correlation matrix with HTML formatting

Description

Although the class ‘cormat’ is not defined, the function is called HTML.cormat, to highlight the fact it should be called only with a correlation matrix. It is documented as a regular S3 method for technical reasons. Contrary to the signature shown, below, you will call it as HTML.cormat, explicitly, as shown in the examples.

Usage

# S3 method for cormat
HTML(x, file = HTMLGetFile(),
digits = 2, append = TRUE, align = "center",
caption = "", captionalign = "bottom",
classcaption = "captiondataframe", classtable = "cormat", useCSS = TRUE, ...)

Value

returns (invisibly) the input

Arguments

x

a correlation matrix

file

target HTLM output

digits

number of digits to use for rounding

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)

useCSS

whether to use CSS or not for traffic highlighting

...

...

Author

Eric Lecoutre

See Also

HTML

Examples

Run this code
	tmpfic=HTMLInitFile(tempdir(),CSSFile="http://www.stat.ucl.ac.be/R2HTML/Pastel.css")
	data(iris)
	HTML(as.title("Fisher Iris dataset / Correlation matrix - normal matrix"),
	     file=tmpfic)
	HTML(cor(iris[,1:4]), file=tmpfic)
	HTML(as.title("Fisher Iris dataset / Correlation matrix - traffic highlighting"),
	     file=tmpfic)
	HTML.cormat(cor(iris[,1:4]), file=tmpfic)

	# File is generated, you can call the browser:
	if (FALSE) browseURL(tmpfic)
	

Run the code above in your browser using DataLab