Skip to content

Instantly share code, notes, and snippets.

@MarkEdmondson1234
Last active July 17, 2020 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkEdmondson1234/846a9b738aba8e300971161043f9d1d1 to your computer and use it in GitHub Desktop.
Save MarkEdmondson1234/846a9b738aba8e300971161043f9d1d1 to your computer and use it in GitHub Desktop.
RStudio snippet to make a shortcut for Shiny Module scaffolding
snippet module
#' ${1:module_name} UI
#'
#' Shiny Module for use with \link{${1:module_name}}
#'
#' @param id Shiny id
#'
#' @return Shiny UI
${1:module_name}UI <- function(id){
ns <- shiny::NS(id)
}
#' ${1:module_name}
#'
#' Shiny Module for use with \link{${1:module_name}UI}
#'
#' Call via \code{shiny::callModule(${1:module_name}, "your_id")}
#'
#' @param input shiny input
#' @param output shiny output
#' @param session shiny session
#'
#' @return Something
${1:module_name} <- function(input, output, session){
ns <- session\$ns
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment