diff --git a/.gitignore b/.gitignore index 807ea25..eabe76b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .Rproj.user .Rhistory .RData + +*~ diff --git a/DESCRIPTION b/DESCRIPTION index 08e030f..8d0b9a6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,7 +10,7 @@ Description: Minimal knowledge of R programming is required to use shinyData. Suggests: shiny, reshape, ggplot2, Hmisc, uuid, plotly, tables, tools, png, plyr, shinysky, Cairo -License: MIT +License: MIT + file LICENSE LazyData: true URL: http://github.com/yindeng/shinyData BugReports: http://github.com/yindeng/shinyData/issues diff --git a/R/main.r b/R/main.r index ea58836..82c2beb 100644 --- a/R/main.r +++ b/R/main.r @@ -1,8 +1,8 @@ #' Run shinyData #' +#' This will open your default browser and run shinyData locally on your computer. +#' #' @export -#' @examples -#' shinyData() shinyData <- function() { shiny::runApp(file.path(system.file("shinyDataApp", package = "shinyData"))) } diff --git a/inst/shinyDataApp/data.r b/inst/shinyDataApp/data.r index 578d175..06d4951 100644 --- a/inst/shinyDataApp/data.r +++ b/inst/shinyDataApp/data.r @@ -3,7 +3,7 @@ observe({ v <- input$datList isolate({ - if(!is.empty(input$datList)) projProperties[['activeDat']] <<- v + if(!isEmpty(input$datList)) projProperties[['activeDat']] <<- v }) }) observe({ @@ -18,8 +18,8 @@ observe({ v <- input$datName isolate({ currentDat <- (projProperties[['activeDat']]) - if(!is.empty(currentDat)){ - if(!is.empty(v) && is.empty(datListNames()[v])){ + if(!isEmpty(currentDat)){ + if(!isEmpty(v) && isEmpty(datListNames()[v])){ datList[[currentDat]][['dynamicProperties']][['name']] <<- v } } @@ -29,7 +29,7 @@ observe({ observe({ updateInput[['datName']] currentDat <- projProperties[['activeDat']] - s <- if(!is.empty(currentDat)){ + s <- if(!isEmpty(currentDat)){ isolate(datList[[currentDat]][['dynamicProperties']][['name']]) } else '' updateTextInput(session, 'datName', value=null2String(s)) @@ -40,7 +40,7 @@ observe({ activeField <- input$fieldsList isolate({ currentDat <- (projProperties[['activeDat']]) - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ datList[[currentDat]][['dynamicProperties']][['activeField']] <<- activeField } }) @@ -49,10 +49,10 @@ observe({ observe({ updateInput[['activeField']] currentDat <- projProperties[['activeDat']] - s <- if(!is.empty(currentDat)){ + s <- if(!isEmpty(currentDat)){ isolate(datList[[currentDat]][['dynamicProperties']][['activeField']]) } else '' - choices <- if(!is.empty(currentDat)) datList[[currentDat]][['fieldNames']]() + choices <- if(!isEmpty(currentDat)) datList[[currentDat]][['fieldNames']]() updateSelectizeInput(session, "fieldsList", choices=null2String(choices), selected=null2String(s)) }) @@ -62,10 +62,10 @@ observe({ v <- (input$fieldName) #make.names isolate({ currentDat <- (projProperties[['activeDat']]) - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ currentField <- (datList[[currentDat]][['dynamicProperties']][['activeField']]) - if(!is.empty(currentField)){ - if(!is.empty(v) && is.empty((datList[[currentDat]][['fieldNames']]())[v])){ + if(!isEmpty(currentField)){ + if(!isEmpty(v) && isEmpty((datList[[currentDat]][['fieldNames']]())[v])){ datList[[currentDat]][['dynamicProperties']][['fieldsList']][[currentField]][['name']] <<- v if(v!=input$fieldName) triggerUpdateInput('fieldName') } @@ -78,9 +78,9 @@ observe({ updateInput[['fieldName']] currentDat <- projProperties[['activeDat']] s <- '' - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ currentField <- datList[[currentDat]][['dynamicProperties']][['activeField']] - if(!is.empty(currentField)){ + if(!isEmpty(currentField)){ s <- isolate(datList[[currentDat]][['dynamicProperties']][['fieldsList']][[currentField]][['name']]) } } @@ -92,7 +92,7 @@ observe({ newMeasures <- input$measures isolate({ currentDat <- (projProperties[['activeDat']]) - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ datList[[currentDat]][['dynamicProperties']][['measures']] <<- newMeasures } }) @@ -100,10 +100,10 @@ observe({ observe({ updateInput[['measures']] currentDat <- projProperties[['activeDat']] - s <- if(!is.empty(currentDat)){ + s <- if(!isEmpty(currentDat)){ isolate(datList[[currentDat]][['dynamicProperties']][['measures']]) } else '' - choices <- if(!is.empty(currentDat)) datList[[currentDat]][['fieldNames']]() + choices <- if(!isEmpty(currentDat)) datList[[currentDat]][['fieldNames']]() updateSelectizeInput(session, "measures", choices=null2String(choices), selected=null2String(s)) }) @@ -133,13 +133,13 @@ observe({ }) output$uploadingTextFile <- reactive({ - T + TRUE }) outputOptions(output, "uploadingTextFile", suspendWhenHidden=FALSE) output$datPreview <- renderDataTable({ currentDat <- projProperties[['activeDat']] - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ datPrev <- datList[[currentDat]][['datR']]() names(datPrev) <- names(datList[[currentDat]][['fieldNames']]()) datPrev diff --git a/inst/shinyDataApp/global.r b/inst/shinyDataApp/global.r index 269721f..873aef1 100644 --- a/inst/shinyDataApp/global.r +++ b/inst/shinyDataApp/global.r @@ -7,7 +7,7 @@ ## Plotly or animit ## conditional calculated field: mutate and ddply; see documentation for ddply -## groups: use selectInput with multiple=T and selectize = F +## groups: use selectInput with multiple=TRUE and selectize = FALSE ## DONE: add sample data mtcars ## http://stackoverflow.com/questions/3418128/how-to-convert-a-factor-to-an-integer-numeric-without-a-loss-of-information @@ -17,7 +17,7 @@ #options(error = browser) options(shiny.error=NULL) # NULL -options(shiny.trace = F) # cahnge to T for trace +options(shiny.trace = FALSE) # change to TRUE for trace #options(shiny.reactlog=TRUE) require(shiny); require(reshape); require(ggplot2); require(Hmisc); require(uuid); require(plotly); @@ -139,7 +139,7 @@ getAesChoices <- function(geom, stat='identity'){ ) } -AesChoicesSimpleList <- unique(unlist(lapply(GeomChoices, getAesChoices), use.names=F)) +AesChoicesSimpleList <- unique(unlist(lapply(GeomChoices, getAesChoices), use.names=FALSE)) fonttable <- read.table(header=TRUE, sep=",", stringsAsFactors=FALSE, text=' diff --git a/inst/shinyDataApp/helpers.r b/inst/shinyDataApp/helpers.r index 826e7fe..e165082 100644 --- a/inst/shinyDataApp/helpers.r +++ b/inst/shinyDataApp/helpers.r @@ -21,7 +21,7 @@ make.png <- function(obj, resolution=NULL) { ') sink() wd <- setwd(tempdir()); on.exit(setwd(wd)) - texi2dvi(file=texFile, index=F) + texi2dvi(file=texFile, index=FALSE) cmd <- paste("dvipng -T tight -o", shQuote(pngFile), @@ -34,7 +34,7 @@ make.png <- function(obj, resolution=NULL) { } newGuid <- function(){ - gsub("-", "_", UUIDgenerate(), fixed=T) + gsub("-", "_", UUIDgenerate(), fixed=TRUE) #paste(sample(c(letters[1:6],0:9),30,replace=TRUE),collapse="") } @@ -49,7 +49,7 @@ setdiff.c <<- function(x, y){ z } else z } -is.empty <<- function(x){ +isEmpty <<- function(x){ is.null(x) || length(x)==0 || all(is.na(x)) || all(x=='') } @@ -57,7 +57,7 @@ ifnull <- function(x, d){ if(is.null(x)) d else x } ifempty <- function(x, d){ - if(is.empty(x)) d else x + if(isEmpty(x)) d else x } null2String <- function(x){ @@ -82,7 +82,7 @@ convertSheetNameToDatName <- function(sheetName){ } names2formula <- function(nms){ - if(!is.empty(nms)){ + if(!isEmpty(nms)){ paste(nms, collapse=" + ") } else " . " } @@ -92,10 +92,10 @@ isFieldUninitialized <- function(obj, field){ } are.vectors.different <- function(x, y){ - if(is.empty(x)){ - !is.empty(y) + if(isEmpty(x)){ + !isEmpty(y) } else { - is.empty(y) || any(x!=y) + isEmpty(y) || any(x!=y) } } @@ -135,7 +135,7 @@ DatClass <- setRefClass("DatClass", fields=c("staticProperties","dynamicProperti measureName <- 'MeasureNames' moltenDat <<- reactive({ - if(!is.empty(dynamicProperties[['measures']])){ + if(!isEmpty(dynamicProperties[['measures']])){ melt(datR(), measure.vars=dynamicProperties[['measures']], variable_name=measureName) } @@ -175,13 +175,13 @@ createNewLayer <- function(){ reactiveValues('geom'='point', 'statType'='identity', 'yFun'='sum', 'layerPositionType'='identity', 'activeAes'='aesX', 'aesList'=sapply(AesChoicesSimpleList, - function(x) reactiveValues('aesAggregate'=F,'aesDiscrete'=T,'aesMapOrSet'='map'), simplify=F)) + function(x) reactiveValues('aesAggregate'=FALSE,'aesDiscrete'=TRUE,'aesMapOrSet'='map'), simplify=FALSE)) } createNewSheetObj <- function(name='Sheet'){ SheetClass$new( 'dynamicProperties'=reactiveValues( 'name'=name, - 'datId'='', 'combineMeasures'=F, 'outputType'='plot', + 'datId'='', 'combineMeasures'=FALSE, 'outputType'='plot', 'columns'='', 'colChoices'='', 'rows'='', 'rowChoices'='', 'outputTable'=NULL, diff --git a/inst/shinyDataApp/server.r b/inst/shinyDataApp/server.r index 8dacd67..04c5009 100644 --- a/inst/shinyDataApp/server.r +++ b/inst/shinyDataApp/server.r @@ -1,5 +1,5 @@ -source('helpers.r', local=T) +source('helpers.r', local=TRUE) shinyServer(function(input, output, session) { @@ -38,11 +38,11 @@ shinyServer(function(input, output, session) { ]][['layerList']][[currentLayer]][['aesList']][[currentAes]] measures <- sheetList[[currentSheet]][['measuresR']]() field <- aes[['aesField']] - if(is.empty(field)){ + if(isEmpty(field)){ field <- sheetList[[currentSheet]][['dynamicProperties' ]][['layerList']][['Plot']][['aesList']][[currentAes]][['aesField']] } - aes[['aesAggregate']] || (!is.empty(field) && field %in% measures) + aes[['aesAggregate']] || (!isEmpty(field) && field %in% measures) }) }) } @@ -72,7 +72,7 @@ shinyServer(function(input, output, session) { if(isFieldUninitialized(sheetList[[currentSheet]],'layerNames')){ sheetList[[currentSheet]][['layerNames']] <<- reactive({ sl <- isolate(sheetList) - if(!is.empty(sl[[currentSheet]][['dynamicProperties']][['layerList']])){ + if(!isEmpty(sl[[currentSheet]][['dynamicProperties']][['layerList']])){ names(sl[[currentSheet]][['dynamicProperties']][['layerList']]) } else c() }) @@ -86,7 +86,7 @@ shinyServer(function(input, output, session) { currentDat <- sl[[currentSheet]][['dynamicProperties']][['datId']] combineMeasures <- sl[[currentSheet]][['dynamicProperties']][['combineMeasures']] - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ currentDatObj <- dl[[currentDat]] if(combineMeasures) currentDatObj[['moltenNames']]() else currentDatObj[['fieldNames']]() } @@ -100,7 +100,7 @@ shinyServer(function(input, output, session) { currentDat <- sl[[currentSheet]][['dynamicProperties']][['datId']] combineMeasures <- sl[[currentSheet]][['dynamicProperties']][['combineMeasures']] - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ currentDatObj <- dl[[currentDat]] if(combineMeasures) c(MoltenMeasuresName) else currentDatObj[['dynamicProperties']][['measures']] } @@ -114,7 +114,7 @@ shinyServer(function(input, output, session) { currentDat <- sl[[currentSheet]][['dynamicProperties']][['datId']] combineMeasures <- sl[[currentSheet]][['dynamicProperties']][['combineMeasures']] - if(!is.empty(currentDat)){ + if(!isEmpty(currentDat)){ currentDatObj <- dl[[currentDat]] if(combineMeasures) currentDatObj[['moltenDat']]() else currentDatObj[['datR']]() } @@ -152,7 +152,7 @@ shinyServer(function(input, output, session) { cc <- empty2NULL(sl[[currentSheet]][['dynamicProperties']][['columns']]) rr <- empty2NULL(sl[[currentSheet]][['dynamicProperties']][['rows']]) datSheet <- sl[[currentSheet]][['datR']]() - validate(need(!is.empty(datSheet), label='Data')) + validate(need(!isEmpty(datSheet), label='Data')) gg <- NULL for(i in c('bar','line','point')) update_geom_defaults(i, list(colour = "darkblue", fill = "darkblue")) @@ -170,7 +170,7 @@ shinyServer(function(input, output, session) { if(!is.null(geom) && !is.null(stat) && !is.null(position)){ ## get effective aesthetics taking into account of inheritance - aes.current <- layer.current[['aesList']][isolate(unlist(layer.current[['aesChoices']], use.names=F))] + aes.current <- layer.current[['aesList']][isolate(unlist(layer.current[['aesChoices']], use.names=FALSE))] aes.current <- sapply(names(aes.current), function(n){ temp <- reactiveValuesToList(aes.current[[n]]) # converting to list so we can modify it if(are.vectors.different(temp[['aesMapOrSet']],'set')){ @@ -183,7 +183,7 @@ shinyServer(function(input, output, session) { } } temp - }, simplify=F) + }, simplify=FALSE) aes.current <- aes.current[sapply(aes.current, function(x) !are.vectors.different(x[['aesMapOrSet']],'set') || !is.null(x[['aesField']]))] @@ -246,7 +246,7 @@ shinyServer(function(input, output, session) { # some validation agg.fields <- sapply(aes.toAgg, function(x) x[['aesFieldOriginal']]) overlaps <- intersect(agg.fields, c(rr,cc)) - validate(need(is.empty(overlaps), 'Can not aggregate fields used in faceting.')) + validate(need(isEmpty(overlaps), 'Can not aggregate fields used in faceting.')) # build the call for ddply .args <- lapply(aes.toAgg, function(x) parse(text=paste(x[['aesAggFun']], '(', x[['aesFieldOriginal']], ')', sep=''))[[1]]) @@ -338,7 +338,7 @@ shinyServer(function(input, output, session) { } } if(!is.null(gg)){ - if(!is.empty(cc) || !is.empty(rr)){ + if(!isEmpty(cc) || !isEmpty(rr)){ gg <- gg + facet_grid(as.formula(paste(names2formula(rr), names2formula(cc), sep=" ~ "))) } gg <- gg + theme_bw() @@ -357,13 +357,13 @@ shinyServer(function(input, output, session) { gg <- sl[[currentSheet]][['plotCore']]() if(!is.null(gg)){ - if(!is.empty(aes.base[['aesX']][['aesField']])){ + if(!isEmpty(aes.base[['aesX']][['aesField']])){ i.match <- match(aes.base[['aesX']][['aesField']], fieldNames) if(!is.na(i.match)){ gg <- gg + xlab(names(fieldNames)[i.match]) } } - if(!is.empty(aes.base[['aesY']][['aesField']])){ + if(!isEmpty(aes.base[['aesY']][['aesField']])){ i.match <- match(aes.base[['aesY']][['aesField']], fieldNames) if(!is.na(i.match)){ gg <- gg + ylab(names(fieldNames)[i.match]) @@ -390,20 +390,20 @@ shinyServer(function(input, output, session) { isDatBasedonSheet <- function(datId, sheetId){ if(!is.null(datList[[datId]])){ while(datList[[datId]][['staticProperties']][['type']] == 'sheet'){ - if(datId==sheetId) return(T) + if(datId==sheetId) return(TRUE) datId <- sheetList[[datId]][['dynamicProperties']][['datId']] } } - F + FALSE } - source('data.r', local=T) - source('sheets.r', local=T) - source('project.r', local=T) + source('data.r', local=TRUE) + source('sheets.r', local=TRUE) + source('project.r', local=TRUE) }) diff --git a/inst/shinyDataApp/sheets.r b/inst/shinyDataApp/sheets.r index a75c4b6..4c3042a 100644 --- a/inst/shinyDataApp/sheets.r +++ b/inst/shinyDataApp/sheets.r @@ -7,9 +7,9 @@ ## Sheet input interdependence observe({ currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']] - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ markType <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['geom']] stat <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['statType']] isolate({ @@ -47,7 +47,7 @@ observe({ cChoices <- setdiff.c(dims, c(all.x, all.y, rr1)) rChoices <- setdiff.c(dims, c(all.x, all.y, cc1)) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ isolate({ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][['aesX']][['fieldChoices']] <<- setdiff.c(fields, c(rr1, cc1)) @@ -124,7 +124,7 @@ observe({ observe({ v <- input$sheetList isolate({ - if(!is.empty(v)) projProperties[['activeSheet']] <<- v + if(!isEmpty(v)) projProperties[['activeSheet']] <<- v }) }) @@ -140,8 +140,8 @@ observe({ v <- input$sheetName isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ - if(!is.empty(v) && is.empty(isolate(sheetListNames())[v])){ + if(!isEmpty(currentSheet)){ + if(!isEmpty(v) && isEmpty(isolate(sheetListNames())[v])){ sheetList[[currentSheet]][['dynamicProperties']][['name']] <<- v } } @@ -151,7 +151,7 @@ observe({ observe({ updateInput[['sheetName']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['name']]) } else '' updateTextInput(session, 'sheetName', value=null2String(s)) @@ -160,7 +160,7 @@ observe({ ## link sheet name to corresponding data name observe({ currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ s <- sheetList[[currentSheet]][['dynamicProperties']][['name']] isolate({ if(!is.null(datList[[currentSheet]])){ @@ -176,14 +176,14 @@ observe({ v <- input$sheetDatList isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['datId']] <<- v + if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['datId']] <<- v }) }) observe({ updateInput[['sheetDatId']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['datId']]) } else '' choices <- datListNames() @@ -197,7 +197,7 @@ observe({ v <- input$combineMeasures isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ sheetList[[currentSheet]][['dynamicProperties']][['combineMeasures']] <<- as.logical(v) } }) @@ -206,9 +206,9 @@ observe({ observe({ updateInput[['combineMeasures']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['combineMeasures']]) - } else F + } else FALSE updateCheckboxInput(session, 'combineMeasures', value=null2String(s)) }) @@ -217,17 +217,17 @@ observe({ v <- input$columns isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['columns']] <<- v + if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['columns']] <<- v }) }) observe({ updateInput[['sheetColumns']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['columns']]) } else '' - choices <- if(!is.empty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['colChoices']]} else '' + choices <- if(!isEmpty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['colChoices']]} else '' updateSelectizeInput(session, 'columns', choices=null2String(choices), selected=null2String(s)) }) @@ -236,17 +236,17 @@ observe({ v <- input$rows isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['rows']] <<- v + if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['rows']] <<- v }) }) observe({ updateInput[['sheetRows']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['rows']]) } else '' - choices <- if(!is.empty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['rowChoices']]} else '' + choices <- if(!isEmpty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['rowChoices']]} else '' updateSelectizeInput(session, 'rows', choices=null2String(choices), selected=null2String(s)) }) @@ -255,14 +255,14 @@ observe({ v <- input$outputTypeList isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['outputType']] <<- v + if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['outputType']] <<- v }) }) observe({ updateInput[['sheetOutput']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['outputType']]) } else '' updateSelectInput(session, 'outputTypeList', selected=null2String(s)) @@ -272,19 +272,19 @@ observe({ observe({ v <- input$layerList isolate({ - if(!is.empty(v)){ + if(!isEmpty(v)){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']] <<- v + if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']] <<- v } }) }) observe({ updateInput[['sheetPlotLayer']] currentSheet <- projProperties[['activeSheet']] - s <- if(!is.empty(currentSheet)){ + s <- if(!isEmpty(currentSheet)){ isolate(sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) } else '' - choices <- if(!is.empty(currentSheet)) sheetList[[currentSheet]][['layerNames']]() + choices <- if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['layerNames']]() updateSelectInput(session, 'layerList', choices=null2String(choices), selected=null2String(s)) }) @@ -293,11 +293,11 @@ observe({ observe({ v <- input$aesList isolate({ - if(!is.empty(v)){ + if(!isEmpty(v)){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)) { + if(!isEmpty(currentSheet)) { currentLayer <- sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']] - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] <<- v } } @@ -308,9 +308,9 @@ observe({ updateInput[['sheetLayerAes']] currentSheet <- projProperties[['activeSheet']] s <- choices <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']]) choices <- (sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesChoices']]) } @@ -326,15 +326,15 @@ observe({ if(!is.null(v)){ isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesMapOrSet']] <<- v ## set default value - if(v=='set' && is.empty(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']])){ + if(v=='set' && isEmpty(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']])){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']] <<- switch(currentAes, 'aesLabel'='My Label', 'aesFamily'='Times', 'aesFontface'='plain', @@ -356,11 +356,11 @@ observe({ updateInput[['aesMapOrSet']] currentSheet <- (projProperties[['activeSheet']]) s <- 'map' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ s1 <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesMapOrSet']]) if(!are.vectors.different('set', s1)) s <- 'set' } @@ -372,11 +372,11 @@ observe({ ## map or set UI output$mapOrSetUI <- renderUI({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ useMapping <- are.vectors.different('set', sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesMapOrSet']]) isolate({ @@ -397,7 +397,7 @@ output$mapOrSetUI <- renderUI({ fluidRow( column(4, selectizeInput(inputId='aesField', label='Field', - choices=choices, selected=s, multiple=F, + choices=choices, selected=s, multiple=FALSE, options = list(create = TRUE)) ), column(4, @@ -406,7 +406,7 @@ output$mapOrSetUI <- renderUI({ conditionalPanel('input.aesAggregate==true', selectizeInput(inputId='aesAggFun', label='By', choices=aggFunchoices, - selected=aggFun, multiple=F, + selected=aggFun, multiple=FALSE, options = list(create = TRUE)) ) @@ -417,7 +417,7 @@ output$mapOrSetUI <- renderUI({ choices=c('Continuous'='continuous', 'Discrete'='discrete'), selected=ifelse(aes[['aesDiscrete']], 'discrete', 'continuous'), - inline=F) + inline=FALSE) ) @@ -442,17 +442,17 @@ output$mapOrSetUI <- renderUI({ observe({ v <- input$aesValue vColor <- input$aesValueColor - ## using is.empty instead of is.null below will cause aesValue not being able to be deleted by user + ## using isEmpty instead of is.null below will cause aesValue not being able to be deleted by user ## not ideal, but due to the inability of setting value on jscolorPicker isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ - if((currentAes=='aesColor' || currentAes=='aesBorderColor') && !is.empty(vColor)) v <- paste('#', vColor, sep='') - if(!is.empty(v)) sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']] <<- v + if(!isEmpty(currentAes)){ + if((currentAes=='aesColor' || currentAes=='aesBorderColor') && !isEmpty(vColor)) v <- paste('#', vColor, sep='') + if(!isEmpty(v)) sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']] <<- v } } } @@ -463,11 +463,11 @@ observe({ # updateInput[['aesValue']] # currentSheet <- (projProperties[['activeSheet']]) # s <- 0 -# if(!is.empty(currentSheet)){ +# if(!isEmpty(currentSheet)){ # currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) -# if(!is.empty(currentLayer)){ +# if(!isEmpty(currentLayer)){ # currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] -# if(!is.empty(currentAes)){ +# if(!isEmpty(currentAes)){ # s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesValue']]) # switch(currentAes, # 'aesLabel'=updateTextInput(session, 'aesValue', value=s), @@ -489,16 +489,16 @@ observe({ if(!is.null(v)){ isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ if(are.vectors.different(v, sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesField']])){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesField']] <<- v ## set default field properties - if(is.empty(v) && currentLayer != 'Plot'){ + if(isEmpty(v) && currentLayer != 'Plot'){ v <- null2String(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][['Plot']][['aesList']][[currentAes]][['aesField']]) } is.measure <- v %in% sheetList[[currentSheet]][['measuresR']]() @@ -518,11 +518,11 @@ observe({ # updateInput[['aesField']] # currentSheet <- (projProperties[['activeSheet']]) # s <- choices <- '' -# if(!is.empty(currentSheet)){ +# if(!isEmpty(currentSheet)){ # currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) -# if(!is.empty(currentLayer)){ +# if(!isEmpty(currentLayer)){ # currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] -# if(!is.empty(currentAes)){ +# if(!isEmpty(currentAes)){ # s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesField']]) # choices <- if(currentAes %in% c('aesX','aesY')) { # sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['fieldChoices']] @@ -537,13 +537,13 @@ observe({ # }) output$canAesFieldBeContinuous <- reactive({ - ans <- F + ans <- FALSE currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ ans <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['canFieldBeContinuous']]() } } @@ -558,11 +558,11 @@ observe({ if(!is.null(v)){ isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesAggregate']] <<- v } } @@ -575,12 +575,12 @@ observe({ updateInput[['aesAggregate']] isolate({ currentSheet <- (projProperties[['activeSheet']]) - s <- F - if(!is.empty(currentSheet)){ + s <- FALSE + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesAggregate']]) } @@ -597,11 +597,11 @@ observe({ v <- input$aesAggFun isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesAggFun']] <<- v } } @@ -613,18 +613,18 @@ observe({ isolate({ currentSheet <- (projProperties[['activeSheet']]) s <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesAggFun']]) } } } choices <- YFunChoices - if(!is.empty(s) && !(s %in% choices)) choices[s]=s + if(!isEmpty(s) && !(s %in% choices)) choices[s]=s updateSelectizeInput(session, 'aesAggFun', choices=null2String(choices), selected=null2String(s)) }) }) @@ -635,11 +635,11 @@ observe({ if(!is.null(v)){ isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesDiscrete']] <<- (v=='discrete') } } @@ -653,13 +653,13 @@ observe({ isolate({ currentSheet <- (projProperties[['activeSheet']]) s <- 'discrete' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ currentAes <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['activeAes']] - if(!is.empty(currentAes)){ + if(!isEmpty(currentAes)){ d <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['aesList']][[currentAes]][['aesDiscrete']]) - if(!is.empty(d) && !d){ + if(!isEmpty(d) && !d){ s <- 'continuous' } @@ -674,11 +674,11 @@ observe({ observe({ v <- input$markList isolate({ - if(!is.empty(v)){ + if(!isEmpty(v)){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['geom']] <<- v # set default stat type & position sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['statType']] <<- @@ -696,9 +696,9 @@ observe({ updateInput[['layerGeom']] currentSheet <- (projProperties[['activeSheet']]) s <- choices <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['geom']]) #choices <- (sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['geomChoices']]) } @@ -710,11 +710,11 @@ observe({ observe({ v <- input$statTypeList isolate({ - if(!is.empty(v)){ + if(!isEmpty(v)){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['statType']] <<- v } @@ -726,9 +726,9 @@ observe({ updateInput[['layerStatType']] currentSheet <- (projProperties[['activeSheet']]) s <- choices <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['statType']]) choices <- (sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['statChoices']]) } @@ -741,11 +741,11 @@ observe({ observe({ v <- input$yFunList isolate({ - if(!is.empty(v)){ + if(!isEmpty(v)){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['yFun']] <<- v } } @@ -756,14 +756,14 @@ observe({ updateInput[['layerYFun']] currentSheet <- (projProperties[['activeSheet']]) s <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['yFun']]) } } choices <- YFunChoices - if(!is.empty(s) && !(s %in% choices)) choices[s]=s + if(!isEmpty(s) && !(s %in% choices)) choices[s]=s updateSelectizeInput(session, 'yFunList', choices=null2String(choices), selected=null2String(s)) }) @@ -774,9 +774,9 @@ observe({ v <- input$layerPositionType isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionType']] <<- v } } @@ -787,9 +787,9 @@ observe({ updateInput[['layerPositionType']] currentSheet <- (projProperties[['activeSheet']]) s <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionType']]) } } @@ -801,9 +801,9 @@ observe({ v <- empty2NULL(as.numeric(input$layerPositionHeight)) isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionHeight']] <<- v } } @@ -814,9 +814,9 @@ observe({ updateInput[['layerPositionHeight']] currentSheet <- (projProperties[['activeSheet']]) s <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionHeight']]) } } @@ -828,9 +828,9 @@ observe({ v <- empty2NULL(as.numeric(input$layerPositionWidth)) isolate({ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionWidth']] <<- v } } @@ -841,9 +841,9 @@ observe({ updateInput[['layerPositionWidth']] currentSheet <- (projProperties[['activeSheet']]) s <- '' - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]][['layerPositionWidth']]) } } @@ -855,12 +855,12 @@ observe({ tabS <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) -canLatexPNG <- tryCatch(length(make.png(tabS)), error=function(e) F) +canLatexPNG <- tryCatch(length(make.png(tabS)), error=function(e) FALSE) output$sheetOutput <- renderUI({ currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ switch(sheetList[[currentSheet]][['dynamicProperties']][['outputType']], 'table'=if(canLatexPNG) imageOutput('sheetOutputTable') else { tags$div( @@ -875,7 +875,7 @@ output$sheetOutput <- renderUI({ output$sheetOutputTable <- renderImage(if(canLatexPNG) { currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ tab <- sheetList[[currentSheet]][['tableR']]() if(!is.null(tab)){ @@ -905,13 +905,13 @@ output$sheetOutputTable <- renderImage(if(canLatexPNG) { ## Reshaped output output$reshapedDat <- renderTable({ currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['outputTable']]} + if(!isEmpty(currentSheet)){sheetList[[currentSheet]][['dynamicProperties']][['outputTable']]} }) output$ggplot <- renderPlot({ if(input$autoRefresh=='refresh'){ currentSheet <- projProperties[['activeSheet']] - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ sheetList[[currentSheet]][['plotR']]() } } else { @@ -930,7 +930,7 @@ observe({ isolate({ if(v){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ existingNames <- names(sheetList[[currentSheet]][['dynamicProperties']][['layerList']]) layerName <- make.unique(c(existingNames, 'Overlay'), sep='_')[length(existingNames)+1] @@ -968,9 +968,9 @@ observe({ isolate({ if(v){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer) && currentLayer!='Plot'){ + if(!isEmpty(currentLayer) && currentLayer!='Plot'){ sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]] <<- NULL sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']] <<- 'Plot' } @@ -984,9 +984,9 @@ observe({ isolate({ if(v){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ currentLayer <- (sheetList[[currentSheet]][['dynamicProperties']][['activeLayer']]) - if(!is.empty(currentLayer)){ + if(!isEmpty(currentLayer)){ temp <- sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]] sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]] <<- NULL sheetList[[currentSheet]][['dynamicProperties']][['layerList']][[currentLayer]] <<- temp @@ -1011,7 +1011,7 @@ observe({ isolate({ if(v){ currentSheet <- (projProperties[['activeSheet']]) - if(!is.empty(currentSheet)){ + if(!isEmpty(currentSheet)){ sheets <- names(sheetList) i <- match(currentSheet, sheets) sheetList[[currentSheet]] <<- NULL diff --git a/inst/shinyDataApp/ui.r b/inst/shinyDataApp/ui.r index d6c70e6..47eddd5 100644 --- a/inst/shinyDataApp/ui.r +++ b/inst/shinyDataApp/ui.r @@ -25,7 +25,7 @@ shinyUI(navbarPage( radioButtons('loadProjectAction', '', choices=c('Replace existing work'='replace', 'Merge with existing work'='merge'), - selected='replace', inline=F), + selected='replace', inline=FALSE), tags$hr(), fluidRow( @@ -73,7 +73,7 @@ shinyUI(navbarPage( tags$hr(), selectizeInput(inputId="measures", label="Measures", - choices=NULL, multiple=T, + choices=NULL, multiple=TRUE, options=list( placeholder = '', plugins = I("['remove_button']"))), @@ -142,7 +142,7 @@ shinyUI(navbarPage( conditionalPanel('input.statTypeList=="summary"', selectizeInput(inputId='yFunList', label='Summarize Y with', choices=YFunChoices, - selected='sum', multiple=F, + selected='sum', multiple=FALSE, options = list(create = TRUE))) ) ), tags$h1('.'), tags$h1('.'), tags$h1('.') @@ -174,7 +174,7 @@ shinyUI(navbarPage( ), tabPanel('Filters', selectizeInput(inputId='filterField', label='Field', - choices=NULL, multiple=F) + choices=NULL, multiple=FALSE) ) ) ), @@ -194,12 +194,12 @@ shinyUI(navbarPage( ), column(4, selectizeInput(inputId="columns", label="Facet Columns", - choices=NULL, multiple=T, + choices=NULL, multiple=TRUE, options=list( placeholder = '', plugins = I("['remove_button','drag_drop']"))), selectizeInput(inputId="rows", label="Facet Rows", - choices=NULL, multiple=T, + choices=NULL, multiple=TRUE, options=list( placeholder = '', plugins = I("['remove_button','drag_drop']"))) diff --git a/man/shinyData.Rd b/man/shinyData.Rd index 7b0f9b5..3a59cad 100644 --- a/man/shinyData.Rd +++ b/man/shinyData.Rd @@ -7,9 +7,6 @@ shinyData() } \description{ -Run shinyData -} -\examples{ -shinyData() +This will open your default browser and run shinyData locally on your computer. }