R2HTML (version 2.3.2)

HTMLInitFile: Begins / Ends a new HTML report output

Description

HTMLInitFile handles the beginning and HTMLEndFile the ending of a HTML report, by writing the HTML <body><head><title></title></head>...</body> tags and their options. When working manually, the user may need to use it's own functions or to explicitly write to a file using cat("", file=).

HTMLInitFile and HTMLSetFile sets the default file path to be used by HTML functions, and HTMLGetFile retrieves it.

Usage

HTMLInitFile(outdir = tempdir(), filename="index", extension="html",
HTMLframe=FALSE, BackGroundColor = "FFFFFF", BackGroundImg = "",
Title = "R output", CSSFile="R2HTML.css", useLaTeX=TRUE, useGrid=TRUE)
HTMLEndFile(file = HTMLGetFile())
HTMLSetFile(file)
HTMLGetFile()

Arguments

outdir

directory to store the output

filename

target HTML report filename

extension

target HTML report extension (htm, html,...)

HTMLframe

should the output be handled by frames [boolean]

BackGroundColor

option bgcolor for HTML tag <body>

BackGroundImg

option background for HTML tag <body>

Title

string to pass to HTML <title> tag

CSSFile

path and name of a CSS file to use

useLaTeX

boolean - add required references to javascript AsciiMathML in order to use as.latex

useGrid

boolean - add required references to javascript grid in order to use R2HTML grid fonctions

file

target HTML file to set as default or to end

Value

physical path of the main HTML file that will serve for the report.

See Also

HTML, as.latex, HTMLgrid

Examples

Run this code
# NOT RUN {
	# Store in target the name of a output file
	dir.create(file.path(tempdir(),"R2HTML"))
	target <- HTMLInitFile(file.path(tempdir(),"R2HTML"),"index", BackGroundColor="#BBBBEE")
	# Use target to write a dataframe
	HTML(as.title("Here is the data frame"),file=target)
	HTML("<br>Don't forget to use the CSS file in order to benefit from fixed size police",
	     file=target)
	tmp <- as.data.frame(matrix(rnorm(100),ncol=10))
	HTML(tmp,file=target)
	HTMLEndFile()
# }

Run the code above in your browser using DataCamp Workspace