Skip to content

Instantly share code, notes, and snippets.

@trestletech
Last active December 15, 2023 15:06
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trestletech/7255596 to your computer and use it in GitHub Desktop.
Save trestletech/7255596 to your computer and use it in GitHub Desktop.
Show the headers in a Shiny app
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));
})
})
shinyUI(pageWithSidebar(
headerPanel("Shiny Client Data"),
sidebarPanel(
uiOutput("headers")
),
mainPanel(
h3("Headers passed into Shiny"),
verbatimTextOutput("summary"),
h3("Value of specified header"),
verbatimTextOutput("value")
)
))
@trestletech
Copy link
Author

https://github.com/colearendt/shiny-session-info is probably better than this.

@pcjedi
Copy link

pcjedi commented Sep 12, 2020

https://github.com/colearendt/shiny-session-info is probably better than this.

Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment