Learn R Programming

sparkTable (version 1.3.0)

export-methods: Saves objects of class 'sparkline', 'sparkbar', 'sparkhist' or 'sparkbox' to a file

Description

Spark-Objects are plotted and saved into different file-formats while for objects of class sparkTable all required graphs are stored and the necessary code to include the graphical table in the desired format is returned to the promt.

Usage

export(object, ...) "export"(object, outputType="pdf", filename="sparkLine", ...) "export"(object, outputType="pdf", filename="sparkBar", ...) "export"(object, outputType="pdf", filename="sparkHist", ...) "export"(object, outputType="pdf", filename="sparkBox", ...) "export"(object, outputType="html", filename=NULL, graphNames="out",infonote=TRUE, scaleByCol=FALSE,...) "export"(object, outputType="html", filename=NULL, graphNames="out", transpose=FALSE, include.rownames=FALSE,include.colnames=FALSE, rownames=NULL,colnames=NULL,...)

Arguments

object
an object of class 'sparkline', 'sparkbox' or 'sparkbar'.
outputType
for objects of class sparkline, sparkbar or sparkbox a character vector specifying the desired output formats. Supported formats are:
  • 'pdf': a pdf image is produced
  • 'eps': an eps image is procuded
  • 'png': a png image is procuded
  • 'svg': a svg image is produced

For objects of class sparkTable a character vector specifying the desired output format, supported types are:

  • "tex": latex output is produced
  • "html": html output (using png-graphs) is generated
  • "htmlsvg": html output (using svg-graphs) is generated

filename
the filename of the output (minus '.pdf', 'eps','.eps', 'svg' for single graphs, minus '.tex' or '.html' for graphical tables
graphNames
the main part of the single graphic files that are produced (minus '-someIndex.extension'
infonote
TRUE/FALSE if the latex command should be included in the output, only used for graphical tables (sparkTable)
scaleByCol
Either TRUE/FALSE to set the scaling for all columns or a TRUE/FALSE vector of the same length as the content object. Keeps the scaling the same in all rows of a column. This parameter is used only for graphical tables (sparkTable)
transpose
logical vector of length 1 defining if the plot be transposed (for geoTable-objects)
include.rownames
logical vector of length 1 defining if rownames should be included (for geoTable-objects)
include.colnames
logical vector of length 1 defining if colnames should be included (for geoTable-objects)
rownames
optional chracter vector specifying row names (for geoTable-objects)
colnames
optional chracter vector specifying column names (for geoTable-objects)
...
additional parameters to be passed, currently not used

Examples

Run this code
## Not run: 
# data(pop)
# x <- pop[pop[,2]=="Insgesamt",3]
# a <- newSparkLine(values=x, pointWidth=8)
# export(a, outputType=c('pdf','png'), filename='myFirstSparkLine')
# 
# # simple graphical table
# data(pop,package="sparkTable")
# b <- newSparkBox()
# l <- newSparkLine()
# bb <- newSparkBar()
# content <- list(function(x) { round(mean(x),2) },
#   b,l,bb,function(x) { round(tail(x,1),2)
# })
# names(content) <- paste("column",1:length(content),sep="")
# varType <- rep("value",length(content))
# pop <- pop[,c("variable","value","time")]
# pop$time <- as.numeric(as.character(pop$time))
# xx <- reshapeExt(pop, varying=list(2))
# x1 <- newSparkTable(xx, content, varType)
# export(x1, outputType="html", graphNames="o2",filename="t1")
# export(x1, outputType="tex", graphNames="o3",filename="t2")
# 
# ##Geo-Table: EU population and debt
# data(popEU,package="sparkTable")
# data(debtEU,package="sparkTable")
# data(coordsEU,package="sparkTable")
# popEU <- popEU[popEU$country%in%coordsEU$country,]
# debtEU <- debtEU[debtEU$country%in%coordsEU$country,]
# EU <- cbind(popEU,debtEU[,-1])
# EUlong <- reshapeExt(EU,
#   idvar="country",v.names=c("pop","debt"),
#   varying=list(2:13,14:25),geographicVar="country",timeValues=1999:2010
# )
# l <- newSparkLine()
# l <- setParameter(l, 'lineWidth', 2.5)
# content <- list(
#   function(x){"Population:"},
#   l,function(x){"Debt:"},l)
# varType <- c(rep("pop",2),rep("debt",2))
# xGeoEU <- newGeoTable(EUlong, content, varType,geographicVar="country",
#   geographicInfo=coordsEU)
# export(xGeoEU, outputType="html", graphNames="outEU",
#   filename="testEUT",transpose=TRUE)
# export(xGeoEU, outputType="html", graphNames="outEU1",
#   filename="testEU", transpose=FALSE)
#  export(xGeoEU, outputType="tex", graphNames="out1",
#   filename="testEU",transpose=FALSE)
# #export(xGeoEU, outputType="tex", graphNames="out1",
#   filename="testEUT",transpose=TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab