Last active
December 15, 2023 15:06
-
-
Save trestletech/7255596 to your computer and use it in GitHub Desktop.
Show the headers in a Shiny app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyServer(function(input, output, session) { | |
output$summary <- renderText({ | |
ls(env=session$request) | |
}) | |
output$headers <- renderUI({ | |
selectInput("header", "Header:", ls(env=session$request)) | |
}) | |
output$value <- renderText({ | |
if (nchar(input$header) < 1 || !exists(input$header, envir=session$request)){ | |
return("NULL"); | |
} | |
return (get(input$header, envir=session$request)); | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyUI(pageWithSidebar( | |
headerPanel("Shiny Client Data"), | |
sidebarPanel( | |
uiOutput("headers") | |
), | |
mainPanel( | |
h3("Headers passed into Shiny"), | |
verbatimTextOutput("summary"), | |
h3("Value of specified header"), | |
verbatimTextOutput("value") | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/colearendt/shiny-session-info is probably better than this.