newSparkTable: Function to create new SparkTable object

Description Usage Arguments Author(s) See Also Examples

Description

User-function to create objects of the class 'sparkTable'.

Usage

1
  newSparkTable(dataObj, tableContent, varType)

Arguments

dataObj

a data frame containing information to be plotted.

tableContent

a list with elements of class 'sparkline','sparkbox','sparkbar' or 'function'

varType

a character vector containing variable names existing in dataObj.

Author(s)

Bernhard Meindl, Alexander Kowarik, Statistics Austria

See Also

plot, export, setParameter, getParameter

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
  ## Not run: 
  ##Soccer
  data(AT_Soccer,package="sparkTable")
  content <- list(
    function(x) {sum(x)},
    function(x) { round(sum(x),2) },
    function(x) { round(sum(x),2) },
    newSparkLine(), newSparkBar()
  )
  names(content) <- c("Points","ShotGoal","GetGoal","GoalDiff","WinLose")
  varType <- c("points","shotgoal","getgoal","goaldiff","wl")
  x1 <- newSparkTable(AT_Soccer, content, varType)
  showSparkTable(x1)
  export(x1,outputType="html")
        
        
  #Population
  data(pop)
  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:5,sep="")
  varType <- rep("value",5)
  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="out1")
  
## End(Not run)

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