html

0th

Percentile

Create an HTML document object representation

Create a "html" object

Usage
html(title = "untitled")
Arguments
title

"character" value: title of the document (in the doc properties).

Details

html objects are experimental ; codes and api will probably change later.

To send R output in an html document, a page (see addPage.html have to be added to the object first (because output is beeing written in pages).

Several methods can used to send R output into an object of class "html".

Once object has content, user can write the htmls pages into a directory, see writeDoc.html.

Value

an object of class "html".

See Also

docx, pptx

Aliases
  • html
Examples
# NOT RUN {
# Create a new document
library( ReporteRs )

# PowerPoint document to write
html.directory <- "document"

# Create a new document
doc = html( title = "document title" )

# add a page with title "Page 1"
doc = addPage( doc, title = "Page 1" )

doc = addTitle( doc, "Texts demo", level = 1 )
texts = c( "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
  	, "In sit amet ipsum tellus. Vivamus dignissim arcu sit amet faucibus auctor."
	, "Quisque dictum tristique ligula."
)
# add simple text
doc = addParagraph( doc, value = texts )

# Add "My tailor is rich" and "Cats and Dogs"
# format some of the pieces of text
pot1 = pot("My tailor", textProperties(color="purple"
	, font.size = 14 ) ) + " is " + pot("rich"
	, textProperties(font.weight="bold") )
my.pars = set_of_paragraphs( pot1 )
pot2 = pot("Cats", textProperties(color="purple", font.size = 14)
) + " and " + pot("Dogs", textProperties(color="blue", font.size = 14) )
my.pars = set_of_paragraphs( pot1, pot2 )
doc <- addParagraph(doc, my.pars )


myplot = qplot(Sepal.Length, Petal.Length
	, data = iris, color = Species
	, size = Petal.Width, alpha = I(0.7)
)

# Add myplot
doc = addTitle( doc, "Plot example 1", level = 1 )
doc = addPlot( doc, function( ) print( myplot ) )

doc = addTitle( doc, "Plot example 2", level = 1 )
doc = addPlot( doc, function( ) {
		print( ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) )
		}
)
doc = addPlot( doc, function( ) {
		plot(iris$Sepal.Length, iris$Petal.Length, col = iris$Species)
		}, fontname = "Arial"
)

# add a slide with layout "Comparison"
doc = addTitle( doc, "Table examples", level = 1 )
doc = addTitle( doc, "Simple add", level = 2 )
# add iris sample
doc = addTable( doc, data = iris[25:33, ] )
doc = addTitle( doc, "Customized table add", level = 2 )

data( data_ReporteRs )
# add dummy dataset and customise some options
doc <- addTable( doc
		, data = data_ReporteRs
		, header.labels = c( "Header 1", "Header 2", "Header 3", "Header 4", "Header 5", "Header 6" )
		, groupedheader.row = list( values = c("Grouped column 1", "Grouped column 2"), colspan = c(3, 3) )
		, col.types = c( "character", "integer", "double", "date", "percent", "character" )
		, columns.font.colors = list(
			col1 = c("#527578", "#84978F", "#ADA692", "#47423F")
			, "col3" = c("#74A6BD", "#7195A3", "#D4E7ED", "#EB8540")
		)
		, columns.bg.colors = list(
			col2 = c("#527578", "#84978F", "#ADA692", "#47423F")
			, "col4" = c("#74A6BD", "#7195A3", "#D4E7ED", "#EB8540")
		)
)

html.files = writeDoc( doc, directory = html.directory )
# browseURL( html.files[1] )
# }
Documentation reproduced from package ReporteRs, version 0.1, License: GPL-3

Community examples

Looks like there are no examples yet.