Learn R Programming

sparkTable (version 0.1.3)

sparkHTML: Create sparklines for HTML

Description

This function creates a HTML file of the selected type and with given parameters.

Usage

sparkHTML(filename, para, type, return = FALSE, fixedIndex = FALSE)

Arguments

filename
the name of the HTML file
para
list of parameters produces by the spark_init function
type
either "line", "bar", or "box"
return
returns HTML code in R
fixedIndex
TRUE/FALSE parameter if the javascript function index should be raised or be fixed.

Value

  • If return=TRUE a list containing two components is returned.
  • headDefinition of the sparkline function including parameters
  • bodyHTML table of the sparkline including the values

See Also

print.sparkTable, setPara, sparkTable_Config, spark, spark_init, sparkHTML,, sparkEPS

Examples

Run this code
# BRP data
data(brp)

brp$Land <- "Oesterreich"
brp_change <- brp[35:67,]

meta <- sparkTable_Config(brp_change,groups=c("Oesterreich"),groupVar="Land",
		vars="BRP", 
		typeNumeric=c("min","median","max","30--32")
		, 
		typePlot=c("line","bar","box"),
		output="html")

obj <- print(meta,outfile="examples/test.html") 



# production index 
data(dat)

pi_konsum <- dat$Energie[6:67]

# creating a line, box plot and bar plot in different HTML files

para <- spark_init(pi_konsum, type="line")
sparkHTML("examples/pi_energie_line.html",para,type="line")

para <- spark_init(pi_konsum, type="box")
sparkHTML("examples/pi_energie_box.html",para,type="box")

para <- spark_init(pi_konsum, type="bar")
sparkHTML("examples/pi_energie_bar.html",para, type="bar")

Run the code above in your browser using DataLab