# see Shiny templates included with the package
ga_model_shiny_template("list")
# see an example of an ui.R template with macros
ga_model_shiny_template("basic/ui.R", read_lines = TRUE)
# see an example of an app.R template with macros
ga_model_shiny_template("basic_app/app.R", read_lines = TRUE)
if (FALSE) {
# a universal analytics model using default template "basic"
ga_model_shiny(
ga_model_example("decomp_ga.gamr"),
auth_dropdown = "universal")
# a template from a directory holding an app.R file
ga_model_shiny(
ga_model_example("decomp_ga.gamr"),
auth_dropdown = "universal",
template = ga_model_shiny_template("basic_app"))
# a template from only an ui.R file that will import boilerplate server.R
ga_model_shiny(
ga_model_example("decomp_ga.gamr"),
auth_dropdown = "universal",
template = ga_model_shiny_template("basic/ui.R"))
# a template from a custom html based theme
ga_model_shiny(
ga_model_example("decomp_ga.gamr"),
auth_dropdown = "universal",
template = ga_model_shiny_template("html_based"))
# a template using library(argonDash)
ga_model_shiny(
ga_model_example("ga-effect.gamr"),
title = "Argon Demo",
auth_dropdown = "universal",
template = ga_model_shiny_template("argonDash") )
# multiple models
m3 <- ga_model_example("time-normalised.gamr")
m4 <- ga_model_example("ga-effect.gamr")
# launch in gentelella template
ga_model_shiny(list(m4, m3), auth_dropdown = "universal",
template = ga_model_shiny_template("gentelella"))
# you can make custom ui embedded within the template file
# use {{{ model_list }}} to work with the models in the ui.R
# below adds custom macro 'theme' and a custom ui in box tabs
ga_model_shiny(list(m4, m3), auth_dropdown = "universal",
template = ga_model_shiny_template("shinythemes"),
theme = "yeti")
# shinydashboard's custom ui functions put a model in each side tab
ga_model_shiny(list(m4, m3), auth_dropdown = "universal",
template = ga_model_shiny_template("shinydashboard"),
skin = "green")
# send in lots of theme variables to bslib in shiny > 1.6.0
ga_model_shiny(list(m4, m3), auth_dropdown = "universal",
template = ga_model_shiny_template("basic_bslib"),
bg = "white", fg = "red", primary = "grey")
# write out an app to a local folder
ga_model_shiny(list(m4, m3), auth_dropdown = "universal",
template = ga_model_shiny_template("basic_bslib"),
bg = "white", fg = "red", primary = "grey",
local_folder = "deploy_shiny")
}
Run the code above in your browser using DataLab