Skip to content

Commit

Permalink
Marketing app updates for shinyapp.io
Browse files Browse the repository at this point in the history
  • Loading branch information
vnijs committed Apr 10, 2015
1 parent 3f2cd84 commit dedbb1e
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 51 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 8 additions & 8 deletions inst/base/for_shinyapps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions inst/base/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions inst/marketing/for_shinyapps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
13 changes: 11 additions & 2 deletions inst/marketing/global.R
Original file line number Diff line number Diff line change
@@ -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"))
}
2 changes: 1 addition & 1 deletion inst/marketing/radiant.R
Original file line number Diff line number Diff line change
@@ -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
38 changes: 22 additions & 16 deletions inst/marketing/server.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion inst/marketing/tools/analysis/conjoint_profiles_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
})

Expand Down
2 changes: 1 addition & 1 deletion inst/marketing/tools/analysis/hier_clus_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
})

Expand Down
2 changes: 1 addition & 1 deletion inst/marketing/tools/analysis/kmeans_clus_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
})

Expand Down
2 changes: 1 addition & 1 deletion inst/marketing/tools/analysis/pre_factor_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
})

Expand Down
2 changes: 1 addition & 1 deletion inst/marketing/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
))
16 changes: 8 additions & 8 deletions inst/quant/for_shinyapps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
4 changes: 3 additions & 1 deletion inst/quant/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions inst/quant/shinyapps/vnijs/quant.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: quant
account: vnijs
bundleId: 161592
url: http://vnijs.shinyapps.io/quant

0 comments on commit dedbb1e

Please sign in to comment.