diff --git a/DESCRIPTION b/DESCRIPTION index a8f0a5537..c3b4fd8ab 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: radiant Title: Business Analytics using R and Shiny -Version: 0.1.94 -Date: 2015-4-9 +Version: 0.1.95 +Date: 2015-4-10 Authors@R: person("Vincent", "Nijs", , "radiant@rady.ucsd.edu", c("aut", "cre")) Description: A platform-independent browser-based interface for business analytics in R, based on the Shiny package. diff --git a/inst/base/for_shinyapps.R b/inst/base/for_shinyapps.R index be802731e..145e3ae24 100644 --- a/inst/base/for_shinyapps.R +++ b/inst/base/for_shinyapps.R @@ -5,11 +5,7 @@ # pkgList <- pkgDep("radiant", repos=repos, type="source", suggests = FALSE) # cat(paste0("library(",paste0(pkgList,collapse=")\nlibrary("),")")) -library(radiant) -library(lubridate) -library(ggplot2) -library(dplyr) -library(magrittr) +library(plyr) library(car) library(MASS) library(gridExtra) @@ -25,10 +21,7 @@ library(tidyr) library(pryr) library(htmlwidgets) library(rpivotTable) -library(shiny) -library(shinyAce) library(DT) -library(plyr) library(stringr) library(mgcv) library(nnet) @@ -72,4 +65,11 @@ library(minqa) library(nloptr) library(RcppEigen) library(colorspace) +library(shiny) +library(shinyAce) library(DT) +library(lubridate) +library(ggplot2) +library(dplyr) +library(magrittr) +library(radiant) diff --git a/inst/base/server.R b/inst/base/server.R index 1b0cf8896..5760251c0 100644 --- a/inst/base/server.R +++ b/inst/base/server.R @@ -15,6 +15,7 @@ shinyServer(function(input, output, session) { } } else { radiant::copy_all(radiant) + set_class <- radiant::set_class } } else { copy_from(radiant, state_init, state_single, state_multiple) diff --git a/inst/marketing/for_shinyapps.R b/inst/marketing/for_shinyapps.R index be802731e..145e3ae24 100644 --- a/inst/marketing/for_shinyapps.R +++ b/inst/marketing/for_shinyapps.R @@ -5,11 +5,7 @@ # pkgList <- pkgDep("radiant", repos=repos, type="source", suggests = FALSE) # cat(paste0("library(",paste0(pkgList,collapse=")\nlibrary("),")")) -library(radiant) -library(lubridate) -library(ggplot2) -library(dplyr) -library(magrittr) +library(plyr) library(car) library(MASS) library(gridExtra) @@ -25,10 +21,7 @@ library(tidyr) library(pryr) library(htmlwidgets) library(rpivotTable) -library(shiny) -library(shinyAce) library(DT) -library(plyr) library(stringr) library(mgcv) library(nnet) @@ -72,4 +65,11 @@ library(minqa) library(nloptr) library(RcppEigen) library(colorspace) +library(shiny) +library(shinyAce) library(DT) +library(lubridate) +library(ggplot2) +library(dplyr) +library(magrittr) +library(radiant) diff --git a/inst/marketing/global.R b/inst/marketing/global.R index f1f685143..69c78a0bc 100644 --- a/inst/marketing/global.R +++ b/inst/marketing/global.R @@ -1,10 +1,19 @@ +# path to use for local and server use +# path <- ".." + +# path to use for shinyapps.io +path <- system.file(package = "radiant") + +# if radiant is not installed revert to path in the inst directory +if(path == "") path <- ".." + # sourcing from radiant base -source('../base/global.R', local = TRUE) +source(paste0(path,"/base/global.R"), local = TRUE) # add functions below that may not be needed in other apps if(!"package:radiant" %in% search()) { addResourcePath("figures_marketing", "tools/help/figures/") - addResourcePath("figures_quant", "../quant/tools/help/figures/") + addResourcePath("figures_quant", paste0(path,"/quant/tools/help/figures/")) # approach to use for shinyapps.io - must have radiant package installed # addResourcePath("figures_quant", system.file("quant/tools/help/figures/", package="radiant")) } diff --git a/inst/marketing/radiant.R b/inst/marketing/radiant.R index dd06a055f..73d87aa4a 100644 --- a/inst/marketing/radiant.R +++ b/inst/marketing/radiant.R @@ -1,4 +1,4 @@ # sourcing from radiant base -source('../base/radiant.R', local = TRUE) +source(paste0(path,"/base/radiant.R"), local = TRUE) # add functions below that may not be needed in other apps diff --git a/inst/marketing/server.R b/inst/marketing/server.R index f1d1a3e90..ed52414e3 100644 --- a/inst/marketing/server.R +++ b/inst/marketing/server.R @@ -1,29 +1,35 @@ shinyServer(function(input, output, session) { # source shared functions - source('../base/init.R', local = TRUE) - source('../base/radiant.R', local = TRUE) + source(paste0(path,"/base/init.R"), local = TRUE) + source(paste0(path,"/base/radiant.R"), local = TRUE) - # for shiny-server + # for shiny-server if(!"package:radiant" %in% search()) { - for(file in list.files("../../R", - pattern="\\.(r|R)$", - full.names = TRUE)) { - - source(file, local = TRUE) - } - } else { - copy_from(radiant, state_init, state_single, state_multiple) - } + if(path == "..") { + for(file in list.files("../../R", + pattern="\\.(r|R)$", + full.names = TRUE)) { + + source(file, local = TRUE) + } + } else { + radiant::copy_all(radiant) + set_class <- radiant::set_class + } + } else { + copy_from(radiant, state_init, state_single, state_multiple) + } # source data & app tools from base - for(file in list.files(c("../base/tools/app", "../base/tools/data"), - pattern="\\.(r|R)$", full.names = TRUE)) + for(file in list.files(c(paste0(path,"/base/tools/app"), + paste0(path,"/base/tools/data")), + pattern="\\.(r|R)$", full.names = TRUE)) source(file, local = TRUE) # source analysis tools from quant app - for(file in list.files(c("../quant/tools/analysis"), - pattern="\\.(r|R)$", full.names = TRUE)) + for(file in list.files(paste0(path,"/quant/tools/analysis"), + pattern="\\.(r|R)$", full.names = TRUE)) source(file, local = TRUE) # source additional analysis tools for marketing app diff --git a/inst/marketing/tools/analysis/conjoint_profiles_ui.R b/inst/marketing/tools/analysis/conjoint_profiles_ui.R index f05bbd6a4..a1bc44e70 100644 --- a/inst/marketing/tools/analysis/conjoint_profiles_ui.R +++ b/inst/marketing/tools/analysis/conjoint_profiles_ui.R @@ -11,7 +11,7 @@ output$ui_conjoint_profiles <- renderUI({ ), help_and_report(modal_title = "Conjoint profiles", fun_name = "conjoint_profiles", - help_file = inclMD("../marketing/tools/help/conjoint_profiles.md")) + help_file = inclMD("tools/help/conjoint_profiles.md")) ) }) diff --git a/inst/marketing/tools/analysis/hier_clus_ui.R b/inst/marketing/tools/analysis/hier_clus_ui.R index b16d6dfcc..206a5c32e 100644 --- a/inst/marketing/tools/analysis/hier_clus_ui.R +++ b/inst/marketing/tools/analysis/hier_clus_ui.R @@ -50,7 +50,7 @@ output$ui_hier_clus <- renderUI({ ), help_and_report(modal_title = "Hierarchical cluster analysis", fun_name = "hier_clus", - help_file = inclMD("../marketing/tools/help/hier_clus.md")) + help_file = inclMD("tools/help/hier_clus.md")) ) }) diff --git a/inst/marketing/tools/analysis/kmeans_clus_ui.R b/inst/marketing/tools/analysis/kmeans_clus_ui.R index b8c65d747..fc25c257e 100644 --- a/inst/marketing/tools/analysis/kmeans_clus_ui.R +++ b/inst/marketing/tools/analysis/kmeans_clus_ui.R @@ -51,7 +51,7 @@ output$ui_kmeans_clus <- renderUI({ ), help_and_report(modal_title = "K-means cluster analysis", fun_name = "kmeans_clus", - help_file = inclMD("../marketing/tools/help/kmeans_clus.md")) + help_file = inclMD("tools/help/kmeans_clus.md")) ) }) diff --git a/inst/marketing/tools/analysis/pre_factor_ui.R b/inst/marketing/tools/analysis/pre_factor_ui.R index 00c366ad2..2f14794a3 100644 --- a/inst/marketing/tools/analysis/pre_factor_ui.R +++ b/inst/marketing/tools/analysis/pre_factor_ui.R @@ -28,7 +28,7 @@ output$ui_pre_factor <- renderUI({ ), help_and_report(modal_title = "Pre-factor analysis", fun_name = "pre_factor", - help_file = inclMD("../marketing/tools/help/pre_factor.md")) + help_file = inclMD("tools/help/pre_factor.md")) ) }) diff --git a/inst/marketing/ui.R b/inst/marketing/ui.R index 7a2e74c54..42d00dad8 100644 --- a/inst/marketing/ui.R +++ b/inst/marketing/ui.R @@ -56,6 +56,6 @@ shinyUI( tabPanel("About", uiOutput("help_about")) ), - includeScript("../base/www/js/session.js"), + includeScript(paste0(path,"/base/www/js/session.js")), tags$head(tags$link(rel="shortcut icon", href="imgs/icon.png")) )) diff --git a/inst/quant/for_shinyapps.R b/inst/quant/for_shinyapps.R index be802731e..145e3ae24 100644 --- a/inst/quant/for_shinyapps.R +++ b/inst/quant/for_shinyapps.R @@ -5,11 +5,7 @@ # pkgList <- pkgDep("radiant", repos=repos, type="source", suggests = FALSE) # cat(paste0("library(",paste0(pkgList,collapse=")\nlibrary("),")")) -library(radiant) -library(lubridate) -library(ggplot2) -library(dplyr) -library(magrittr) +library(plyr) library(car) library(MASS) library(gridExtra) @@ -25,10 +21,7 @@ library(tidyr) library(pryr) library(htmlwidgets) library(rpivotTable) -library(shiny) -library(shinyAce) library(DT) -library(plyr) library(stringr) library(mgcv) library(nnet) @@ -72,4 +65,11 @@ library(minqa) library(nloptr) library(RcppEigen) library(colorspace) +library(shiny) +library(shinyAce) library(DT) +library(lubridate) +library(ggplot2) +library(dplyr) +library(magrittr) +library(radiant) diff --git a/inst/quant/server.R b/inst/quant/server.R index 47cfbed83..d3edddb1d 100644 --- a/inst/quant/server.R +++ b/inst/quant/server.R @@ -15,13 +15,15 @@ shinyServer(function(input, output, session) { } } else { radiant::copy_all(radiant) + set_class <- radiant::set_class } } else { copy_from(radiant, state_init, state_single, state_multiple) } # source data & app tools from base - for(file in list.files(c(paste0(path,"/base/tools/app"), paste0(path,"/base/tools/data")), + for(file in list.files(c(paste0(path,"/base/tools/app"), + paste0(path,"/base/tools/data")), pattern="\\.(r|R)$", full.names = TRUE)) source(file, local = TRUE) diff --git a/inst/quant/shinyapps/vnijs/quant.dcf b/inst/quant/shinyapps/vnijs/quant.dcf new file mode 100644 index 000000000..92f420e7f --- /dev/null +++ b/inst/quant/shinyapps/vnijs/quant.dcf @@ -0,0 +1,4 @@ +name: quant +account: vnijs +bundleId: 161592 +url: http://vnijs.shinyapps.io/quant