Skip to content

Commit

Permalink
version 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkowa authored and cran-robot committed Jul 1, 2014
1 parent d2af07f commit 4955881
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 579 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,15 +1,15 @@
Package: sparkTable
Type: Package
Title: Sparklines and graphical tables for tex and html
Version: 0.10.0
Date: 2014-05-23
Author: Alexander Kowarik, Bernhard Meindl, Matthias Templ
Version: 0.11.0
Date: 2014-07-01
Author: Alexander Kowarik, Bernhard Meindl, Matthias Templ
Maintainer: Alexander Kowarik <alexander.kowarik@statistik.gv.at>
Description: Create Sparklines and graphical tables for documents and websites
Description: Create Sparklines and graphical tables for documents and websites
Depends: utils, grid, Cairo, methods,gridExtra,ggplot2,shiny
Imports: xtable,StatMatch,Rglpk,pixmap,RGraphics
License: GPL
Packaged: 2014-05-23 08:33:56 UTC; kowa$
Packaged: 2014-07-01 07:35:25 UTC; KOWA$
NeedsCompilation: no
Repository: CRAN
Date/Publication: 2014-05-23 11:14:15
Date/Publication: 2014-07-01 09:57:08
14 changes: 7 additions & 7 deletions MD5
@@ -1,9 +1,9 @@
5f982716ef08f4d8cfa0f025b46db35f *DESCRIPTION
9d4ba9d5ff7fd5679ba8011ba1bf926f *DESCRIPTION
96132a25d3f6dbac7b7a686281fc2e2d *NAMESPACE
db5909adffac0080d001d442069d0a87 *R/auxFunctions.r
d3265ca4910cb2b77d750fc8c438a6e0 *R/checkerplot.R
4e9876fc74a1192be00c35436de016a3 *R/classes.r
309556b7bb1491edf8296f294d083b18 *R/exports.r
0ecdac88549e1a921d5749ffcf9a883b *R/exports.r
c38263b71c3433fdea3c1517d5a2d502 *R/methods.r
b9518bf14c24621a87a52bc7cc68f736 *R/optimal_grid_allocation.R
80dccdbf1b83610b5dc37040891ca27d *R/runShinyApp.R
Expand Down Expand Up @@ -109,9 +109,9 @@ a75b00c72cf7d77e531af0db80e40056 *inst/etc/Flaggen/USStates/VA.pnm
36688a9912573eaff1b2b05a04c53ca1 *inst/etc/Flaggen/USStates/WI.pnm
34747457dfb2e543d849531ee9a7e1b9 *inst/etc/Flaggen/USStates/WV.pnm
313f8a0a5d795fe371b9b32d0c788ce7 *inst/etc/Flaggen/USStates/WY.pnm
96441d88adf87819cb30757479aac760 *inst/shinystuff/shinypara_global.R
6b3a8ed170a9c8d05220c18a43a5718c *inst/shinystuff/shinypara_server.R
36ef39c374c13e638d080b72b8f1c293 *inst/shinystuff/shinypara_ui.R
d6062b9a3361daca1427662307433267 *inst/shinystuff/shinypara_global.R
979edecac1bb3618cf6cddd08656cfe1 *inst/shinystuff/shinypara_server.R
f69a607a521e55bf03be47d4d25e203b *inst/shinystuff/shinypara_ui.R
c5a728e8d02ec89af0bb59a085a2f0d9 *inst/shinystuff/www/js/jquery-ui.min.js
ba88f287c6599582d9c4c418964fcc4d *inst/shinystuff/www/js/sort.js
0abc22df76cc1cab707b9ce8553f45c0 *inst/shinystuff/www/sort.css
Expand All @@ -126,12 +126,12 @@ ddb533085d5998b21adbd45b3ea81049 *man/optimal_grid_allocation.Rd
3775e55802bb780924f158d3ccbf09e3 *man/plotGeoTable.Rd
9d892761a3c30d167215af0467de4c81 *man/plotSparkTable.Rd
40ff8e7f6199de896fd78f7235cb7022 *man/plotSparks.Rd
21ccd3b69495aad901bf18d9a9014b13 *man/reshapeExt.Rd
f83dff45c9f70a8407881e09e49a30d0 *man/reshapeExt.Rd
731b7db574dcbcc6002fc8184079445d *man/runShinyApp-methods.Rd
829f09d28f694d64a5f86e3fca5c9322 *man/setParameter.Rd
3fc00ccace24730f4d960459a164dfa6 *man/shiny_sparkTable-methods.Rd
c5f36fa3d8bc442ea3d8241be6d2ad81 *man/sparkTable-class.Rd
a97307d7a9fe70cc0a2319ab26056ae9 *man/sparkbar-class.Rd
d4042ce487f59aef499cb754f98488de *man/sparkbox-class.Rd
213b80e17540e7f7b9f36e90ef0266eb *man/sparkline-class.Rd
9fb0220024bb0addc428a63b4877e9be *man/summaryST.Rd
5a30c6089c9a7a5ba2e28194e3af100c *man/summaryST.Rd
24 changes: 21 additions & 3 deletions R/exports.r
Expand Up @@ -228,9 +228,25 @@ newSparkBox <- function(width=NULL, height=NULL, values=NULL, padding=NULL, boxO

# use reshapeExt to transform data that are already in 'long'
# format and required attributes
reshapeExt <- function(x,timeValues=NULL,geographicVar=NULL,...){
# based on reshape from package 'stats'
reshapeExt <- function(
data,
timeValues = NULL,
geographicVar=NULL,
varying = NULL, v.names = NULL, timevar = "time",
idvar = "id", ids = 1:NROW(data),
drop = NULL, new.row.names = NULL,
sep = ".",
split = if (sep == "") {
list(regexp = "[A-Za-z][0-9]", include = TRUE)
} else {
list(regexp = sep, include = FALSE, fixed = TRUE)}
){
x <- data
if(is.null(geographicVar)){
dat <- reshape(x,direction="long",...)
dat <- reshape(x,direction="long",varying=varying,v.names=v.names,timevar=timevar,
idvar=idvar,ids=ids, drop=drop,new.row.names=new.row.names,
sep=sep,split=split)
n1 <- (nrow(dat)/length(unique(dat[,1])))
if(is.null(timeValues))
timeValues <- 1:n1
Expand All @@ -244,7 +260,9 @@ reshapeExt <- function(x,timeValues=NULL,geographicVar=NULL,...){
}else{
dat <- list()
for(co in unique(x[,geographicVar])){
dat[[co]] <- reshape(x[x[,geographicVar]==co,],direction="long",...)
dat[[co]] <- reshape(x[x[,geographicVar]==co,],direction="long",varying=varying,v.names=v.names,timevar=timevar,
idvar=idvar,ids=ids, drop=drop,new.row.names=new.row.names,
sep=sep,split=split)
n1 <- (nrow(dat[[co]])/length(unique(dat[[co]][,1])))
if(is.null(timeValues))
timeValues <- 1:n1
Expand Down
218 changes: 109 additions & 109 deletions inst/shinystuff/shinypara_global.R
Expand Up @@ -9,138 +9,138 @@ tempdir <- dirs[2]
# manage columns of sparkTable obj
#manage.cols <- function(i, inp, varType, input) {
manage.cols <- function(i, inp, input) {
if ( is.null(input) ) {
return(inp)
}
v <- eval(parse(text=paste("input$col",i,sep="")))
if ( !is.null(v) ) {
if ( v == "line" ) {
inp[[i]] <- newSparkLine()

# point width
v.pw <- eval(parse(text=paste("input$pointwidth_slider",i,sep="")))
if ( !is.null(v.pw) ) {
pointWidth(inp[[i]]) <- v.pw
}
v.lw <- eval(parse(text=paste("input$linewidth_slider",i,sep="")))
if ( !is.null(v.lw) ) {
lineWidth(inp[[i]]) <- v.lw
}
v.show_iqr <- eval(parse(text=paste("input$bool_show_iqr",i,sep="")))
if ( !is.null(v.lw) ) {
inp[[i]]@showIQR <- ifelse(v.show_iqr=="yes", TRUE, FALSE)
}
}
if ( v == "box" ) {
inp[[i]] <- newSparkBox()
if ( is.null(input) ) {
return(inp)
}
v <- eval(parse(text=paste("input$col",i,sep="")))
if ( !is.null(v) ) {
if ( v == "line" ) {
inp[[i]] <- newSparkLine()

v.outcol <- eval(parse(text=paste("input$outcol_select",i,sep="")))
if ( !is.null(v.outcol) ) {
inp[[i]]@outCol <- v.outcol
}
v.bordercol <- eval(parse(text=paste("input$bordercol_select",i,sep="")))
if ( !is.null(v.bordercol) ) {
inp[[i]]@boxCol[1] <- v.bordercol
}
v.maincol <- eval(parse(text=paste("input$maincol_select",i,sep="")))
if ( !is.null(v.maincol) ) {
inp[[i]]@boxCol[2] <- v.maincol
}
}
if ( v == "hist" ) {
inp[[i]] <- newSparkHist()
v.histcol2 <- eval(parse(text=paste("input$histcol_2_select",i,sep="")))
if ( !is.null(v.histcol2) ) {
inp[[i]]@barCol[2] <- v.histcol2
}
v.histcol3 <- eval(parse(text=paste("input$histcol_3_select",i,sep="")))
if ( !is.null(v.histcol3) ) {
inp[[i]]@barCol[3] <- v.histcol3
}
v.histspacing <- eval(parse(text=paste("input$histspacing_slider",i,sep="")))
if ( !is.null(v.histspacing) ) {
inp[[i]]@barSpacingPerc <- v.histspacing
}
}
if ( v == "bar" ) {
inp[[i]] <- newSparkBar()
#v.barcol1 <- eval(parse(text=paste("input$barcol_1_select",i,sep="")))
#if ( !is.null(v.barcol1) ) {
# inp[[i]]@barCol[1] <- v.barcol1
#}
v.barcol2 <- eval(parse(text=paste("input$barcol_2_select",i,sep="")))
if ( !is.null(v.barcol2) ) {
inp[[i]]@barCol[2] <- v.barcol2
}
v.barcol3 <- eval(parse(text=paste("input$barcol_3_select",i,sep="")))
if ( !is.null(v.barcol3) ) {
inp[[i]]@barCol[3] <- v.barcol3
}
v.barspacing <- eval(parse(text=paste("input$barspacing_slider",i,sep="")))
if ( !is.null(v.barspacing) ) {
inp[[i]]@barSpacingPerc <- v.barspacing
}
}
if ( v == "func" ) {
fnval <- eval(parse(text=paste("input$fn",i,sep="")))
if ( is.null(fnval) ) {
fnval <- "function(x) { x }"
}
fn <- eval(parse(text=fnval))
inp[[i]] <- fn
}
}

v <- eval(parse(text=paste("input$colname",i,sep="")))
if ( !is.null(v) ) {
#cat("something has changed!\n"); flush.console()
names(inp)[i] <- v
}
return(inp)
# point width
v.pw <- eval(parse(text=paste("input$pointwidth_slider",i,sep="")))
if ( !is.null(v.pw) ) {
sparkTable:::pointWidth(inp[[i]]) <- v.pw
}
v.lw <- eval(parse(text=paste("input$linewidth_slider",i,sep="")))
if ( !is.null(v.lw) ) {
sparkTable:::lineWidth(inp[[i]]) <- v.lw
}
v.show_iqr <- eval(parse(text=paste("input$bool_show_iqr",i,sep="")))
if ( !is.null(v.lw) ) {
inp[[i]]@showIQR <- ifelse(v.show_iqr=="yes", TRUE, FALSE)
}
}
if ( v == "box" ) {
inp[[i]] <- newSparkBox()

v.outcol <- eval(parse(text=paste("input$outcol_select",i,sep="")))
if ( !is.null(v.outcol) ) {
inp[[i]]@outCol <- v.outcol
}
v.bordercol <- eval(parse(text=paste("input$bordercol_select",i,sep="")))
if ( !is.null(v.bordercol) ) {
inp[[i]]@boxCol[1] <- v.bordercol
}
v.maincol <- eval(parse(text=paste("input$maincol_select",i,sep="")))
if ( !is.null(v.maincol) ) {
inp[[i]]@boxCol[2] <- v.maincol
}
}
if ( v == "hist" ) {
inp[[i]] <- newSparkHist()
v.histcol2 <- eval(parse(text=paste("input$histcol_2_select",i,sep="")))
if ( !is.null(v.histcol2) ) {
inp[[i]]@barCol[2] <- v.histcol2
}
v.histcol3 <- eval(parse(text=paste("input$histcol_3_select",i,sep="")))
if ( !is.null(v.histcol3) ) {
inp[[i]]@barCol[3] <- v.histcol3
}
v.histspacing <- eval(parse(text=paste("input$histspacing_slider",i,sep="")))
if ( !is.null(v.histspacing) ) {
inp[[i]]@barSpacingPerc <- v.histspacing
}
}
if ( v == "bar" ) {
inp[[i]] <- newSparkBar()
#v.barcol1 <- eval(parse(text=paste("input$barcol_1_select",i,sep="")))
#if ( !is.null(v.barcol1) ) {
# inp[[i]]@barCol[1] <- v.barcol1
#}
v.barcol2 <- eval(parse(text=paste("input$barcol_2_select",i,sep="")))
if ( !is.null(v.barcol2) ) {
inp[[i]]@barCol[2] <- v.barcol2
}
v.barcol3 <- eval(parse(text=paste("input$barcol_3_select",i,sep="")))
if ( !is.null(v.barcol3) ) {
inp[[i]]@barCol[3] <- v.barcol3
}
v.barspacing <- eval(parse(text=paste("input$barspacing_slider",i,sep="")))
if ( !is.null(v.barspacing) ) {
inp[[i]]@barSpacingPerc <- v.barspacing
}
}
if ( v == "func" ) {
fnval <- eval(parse(text=paste("input$fn",i,sep="")))
if ( is.null(fnval) ) {
fnval <- "function(x) { x }"
}
fn <- eval(parse(text=fnval))
inp[[i]] <- fn
}
}

v <- eval(parse(text=paste("input$colname",i,sep="")))
if ( !is.null(v) ) {
#cat("something has changed!\n"); flush.console()
names(inp)[i] <- v
}
return(inp)
}

manage.vars <- function(i, varType, input) {
if ( is.null(input) ) {
return(varType)
}
v <- eval(parse(text=paste("input$varType",i,sep="")))
if ( !is.null(v) ) {
varType[i] <- v
}
return(varType)
if ( is.null(input) ) {
return(varType)
}
v <- eval(parse(text=paste("input$varType",i,sep="")))
if ( !is.null(v) ) {
varType[i] <- v
}
return(varType)
}

actionButton <- function (inputId, label, style=NULL) {
tags$button(id = inputId, type="button", class=paste("btn action-button", style), label)
}

textInput <- function (inputId, label, value = "") {
if ( is.null(label) ) {
tagList(tags$input(id = inputId, type = "text", value = value))
} else {
tagList(tags$label(label, `for` = inputId), tags$input(id = inputId, type = "text", value = value))
}
textInput <- function (inputId, label, value = "") {
if ( is.null(label) ) {
tagList(tags$input(id = inputId, type = "text", value = value))
} else {
tagList(tags$label(label, `for` = inputId), tags$input(id = inputId, type = "text", value = value))
}
}

html_list <- function(vars, id) {
hl <- paste0("<ul id=\'",id,"\' class='stab'>")
for( i in vars ) {
hl <- paste0(hl, "<li class='ui-state-default stab'><span class='label'>",i,"</span></li>")
}
hl <- paste0(hl, "<li class='ui-state-default stab'><span class='label'>",i,"</span></li>")
}
paste0(hl, "</ul>")
}

returnOrderCols <- function(inputId, vars) {
tagList(
h3("please drag and drop the columns into the desired order"),
HTML(html_list(vars, inputId)),
tags$script(paste0("$(function() {$( '#",inputId,"' ).sortable({placeholder: 'ui-state-highlight'}); $( '#",inputId,"' ).disableSelection(); });"))
h3("Please drag and drop the columns into the desired order"),
HTML(html_list(vars, inputId)),
tags$script(paste0("$(function() {$( '#",inputId,"' ).sortable({placeholder: 'ui-state-highlight'}); $( '#",inputId,"' ).disableSelection(); });"))
)
}
returnOrderRows <- function(inputId, vars) {
tagList(
h3("please drag and drop the rows (groups) into the desired order"),
HTML(html_list(vars, inputId)),
tags$script(paste0("$(function() {$( '#",inputId,"' ).sortable({placeholder: 'ui-state-highlight'}); $( '#",inputId,"' ).disableSelection(); });"))
h3("Please drag and drop the rows (groups) into the desired order"),
HTML(html_list(vars, inputId)),
tags$script(paste0("$(function() {$( '#",inputId,"' ).sortable({placeholder: 'ui-state-highlight'}); $( '#",inputId,"' ).disableSelection(); });"))
)
}

0 comments on commit 4955881

Please sign in to comment.