export: Saves objects of class 'sparkline', 'sparkbar', 'sparkhist'...

Description Usage Arguments Author(s) Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  export(object, ...)
  ## S4 method for signature 'sparkline'
export(object, outputType="pdf", filename="sparkLine", ...)
  ## S4 method for signature 'sparkbar'
export(object, outputType="pdf", filename="sparkBar", ...)
  ## S4 method for signature 'sparkhist'
export(object, outputType="pdf", filename="sparkHist", ...)
  ## S4 method for signature 'sparkbox'
export(object, outputType="pdf", filename="sparkBox", ...)
  ## S4 method for signature 'sparkTable'
export(object, outputType="html", filename=NULL,
    graphNames="out",infonote=TRUE, scaleByCol=FALSE,...)
  ## S4 method for signature 'geoTable'
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

Author(s)

Bernhard Meindl, Alexander Kowarik, Statistics Austria

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## 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)

alexkowa/sparkTable documentation built on May 12, 2019, 12:29 a.m.