Description Usage Arguments Methods See Also Examples
~~ Methods for function showSparkTable
~~
1 2 | showSparkTable(object, outputDir=tempdir(),outputType="html", filename=NULL,
graphNames="out", ...)
|
object |
an object of class 'sparkTable' or 'data.frame' |
outputDir |
a path to a directory for the output (Default=temporary directory) |
outputType |
a character vector of length one specifying the desired output format:
|
filename |
the filename of the output (minus '.tex' or '.html' |
graphNames |
the main part of the single graphic files that are produced (minus '-someIndex.extension' |
... |
additional parameters to be passed to |
signature(object = "sparkTable")
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 53 54 | ## Not run:
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)
showSparkTable(x1)
#Example Hist+Box with 2 variables in 10 different groups
datEx <- data.frame(
variable=sample(paste("Cat",1:10,sep="_"),1000,replace=TRUE),
value=rnorm(1000),value2=rlnorm(1000)
)
b <- newSparkBox()
h <- newSparkHist()
content <- list(
function(x) { round(mean(x),2) },
function(x) { round(median(x),2) },
function(x) { round(quantile(x,.25),2) },
function(x) { round(quantile(x,.75),2) },
b,
h,
function(x) { round(mean(x),2) },
function(x) { round(median(x),2) },
function(x) { round(quantile(x,.25),2) },
function(x) { round(quantile(x,.75),2) },
b,
h
)
names(content) <- c(
paste(c("Mean","Median","Q25","Q75","Boxplot","Histogram"),"_v1",sep=""),
paste(c("Mean","Median","Q25","Q75","Boxplot","Histogram"),"_v2",sep="")
)
varType <- c(rep("value",length(content)/2),rep("value2",length(content)/2))
datEx <- reshapeExt(datEx, varying=list(2,3))
x2 <- newSparkTable(datEx, content, varType)
showSparkTable(x2)
#Example for the data.frame method (uses summaryST)
data2 <- data.frame(x1=rnorm(100),x2=rnorm(100)+1,x3=rnorm(100)+5)
showSparkTable(data2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.