R/mod_varinfo.R

Defines functions mod_varinfo_server mod_varinfo_ui

#' varinfo UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd 
#'
#' @importFrom shiny NS tagList 
mod_varinfo_ui <- function(id){
  ns <- NS(id)
  tagList(
  
    
    semantic.dashboard::box(width = 8,
                            title = 'Study Method',
                            ribbon = TRUE    
    ),
    
semantic.dashboard::box(width = 8,
                        title = 'Variable Information',
                        ribbon = TRUE,
  shiny.semantic::dropdown_input(ns("varname"),
                   names(dataset),
                   value = NULL,
                   type = 'multiple',
                   default_text = 'Select Study Variable'),
    
  shiny::htmlOutput(ns("code"))
  )


)
}
    
#' varinfo Server Functions
#'
#' @noRd 
mod_varinfo_server <- function(id){
  moduleServer( id, function(input, output, session){
    ns <- session$ns
    
    #data("vardesc") 
    
    
    
    output$code <- shiny::renderUI({   
      
        HTML(
          paste(
            vardesc$desc[ vardesc$variable %in% input$varname ],collapse  =  '<br/> <br/>'
            )
          )
      
    }) 
    
    
  })
}
    
## To be copied in the UI
# mod_varinfo_ui("varinfo_ui_1")
    
## To be copied in the server
# mod_varinfo_server("varinfo_ui_1")
gavandrewj/pdphApp documentation built on Dec. 20, 2021, 9:48 a.m.