Learn R Programming

periscope (version 1.0.4)

create_new_application: Create a new templated framework application

Description

Creates ready-to-use templated application files using the periscope framework. The application can be created either empty (default) or with a sample/documented example application.

A running instance of the exact sample application that will be created is hosted here if you would like to see the sample application before creating your own copy.

Usage

create_new_application(
  name,
  location,
  sampleapp = FALSE,
  resetbutton = TRUE,
  rightsidebar = FALSE,
  leftsidebar = TRUE,
  custom_theme_file = NULL
)

Arguments

name

name for the new application and directory

location

base path for creation of name

sampleapp

whether to create a sample shiny application

resetbutton

whether the reset button should be added on the Advanced (left) sidebar.

rightsidebar

parameter to set the right sidebar. It can be TRUE/FALSE or a character containing the name of a shiny::icon().

leftsidebar

whether the left sidebar should be enabled.

custom_theme_file

location of custom theme settings yaml file. Default value is NULL.

Name

The name directory must not exist in location. If the code detects that this directory exists it will abort the creation process with a warning and will not create an application template.

Use only filesystem-compatible characters in the name (ideally w/o spaces)

Directory Structure


name
 -- www (supporting shiny files)
 -- program (user application)
 -- -- data (user application data)
 -- -- fxn  (user application function)
 -- log (log files)

File Information

All user application creation and modifications will be done in the program directory. The names & locations of the framework-provided .R files should not be changed or the framework will fail to work as expected.

name/program/ui_body.R :
Create body UI elements in this file and register them with the framework using a call to add_ui_body

name/program/ui_sidebar.R :
Create sidebar UI elements in this file and register them with the framework using a call to add_ui_sidebar_basic or add_ui_sidebar_advanced

name/program/ui_sidebar_right.R :
Create right sidebar UI elements in this file and register them with the framework using a call to add_ui_sidebar_right

name/program/data directory :
Use this location for data files. There is a .gitignore file included in this directory to prevent accidental versioning of data

name/program/global.R :
Use this location for code that would have previously resided in global.R and for setting application parameters using set_app_parameters. Anything placed in this file will be accessible across all user sessions as well as within the UI context.

name/program/server_global.R :
Use this location for code that would have previously resided in server.R above (i.e. outside of) the call to shinyServer(...). Anything placed in this file will be accessible across all user sessions.

name/program/server_local.R :
Use this location for code that would have previously resided in server.R inside of the call to shinyServer(...). Anything placed in this file will be accessible only within a single user session.

name/www/periscope_style.yaml :
This is the application custom styling yaml file. User can update application different parts style using this file.


Do not modify the following files:


name\global.R
name\server.R
name\ui.R
name\www\img\loader.gif
name\www\img\tooltip.png

Right Sidebar


 value
 FALSE   --- no sidebar
 TRUE    --- sidebar with default icon ('gears').
 "table" --- sidebar with table icon. The character string should be a valid "font-awesome" icon.
 

See Also

shiny:icon()

shinydashboard:dashboardPage()

Examples

Run this code
# sample app named 'mytestapp' created in a temp dir
create_new_application(name = 'mytestapp', location = tempdir(), sampleapp = TRUE)

# sample app named 'mytestapp' with a right sidebar using a custom icon created in a temp dir
create_new_application(name = 'mytestapp', location = tempdir(), sampleapp = TRUE, 
rightsidebar = "table")

# blank app named 'myblankapp' created in a temp dir
create_new_application(name = 'myblankapp', location = tempdir())
# blank app named 'myblankapp' with a green skin created in a temp dir
create_new_application(name = 'myblankapp', location = tempdir())
# blank app named 'myblankapp' without a left sidebar created in a temp dir
create_new_application(name = 'myblankapp', location = tempdir(), leftsidebar = FALSE)

Run the code above in your browser using DataLab