Fallstudier: Bygg webbapplikationer med Shiny i R
Dean Attali
Shiny Consultant



ui <- fluidPage(
textInput(inputId = "name", label = "Enter your name",
value = "Dean"),
numericInput(inputId = "sibs", label = "How many siblings?",
value = 4, min = 0)
)
*Input(inputId, label, ...)inputId = Unikt IDlabel = Text som beskriver indata... = Ytterligare indataspecifika parametrarTvå steg:
Skapa platshållare för utdata (i UI)
ui <- fluidPage(
"Plot goes here:",
plotOutput(outputId = "my_plot")
)
Skriv R-kod för att generera utdata (i server)
server <- function(input, output) {
# Code for building outputs
}
inputoutputui <- fluidPage( numericInput("num", "Number of rows", value = 10, min = 0), tableOutput("my_table") )server <- function(input, output) { output$my_table <- renderTable({ head(iris, n = input$num) }) }
renderPlot(), renderText(), osv.)output$<outputId>input$<inputId> för att läsa indatavärdetFallstudier: Bygg webbapplikationer med Shiny i R