Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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