| 1 |
library(shiny) |
| 2 |
|
| 3 |
# Define UI for random distribution app ---- |
| 4 |
fluidPage( |
| 5 |
|
| 6 |
# App title ---- |
| 7 |
titlePanel("Tabsets"), |
| 8 |
|
| 9 |
# Sidebar layout with input and output definitions ---- |
| 10 |
sidebarLayout( |
| 11 |
|
| 12 |
# Sidebar panel for inputs ---- |
| 13 |
sidebarPanel( |
| 14 |
|
| 15 |
# Input: Select the random distribution type ---- |
| 16 |
radioButtons("dist", "Distribution type:", |
| 17 |
c("Normal" = "norm", |
| 18 |
"Uniform" = "unif", |
| 19 |
"Log-normal" = "lnorm", |
| 20 |
"Exponential" = "exp")), |
| 21 |
|
| 22 |
# br() element to introduce extra vertical spacing ---- |
| 23 |
br(), |
| 24 |
|
| 25 |
# Input: Slider for the number of observations to generate ---- |
| 26 |
sliderInput("n", |
| 27 |
"Number of observations:", |
| 28 |
value = 500, |
| 29 |
min = 1, |
| 30 |
max = 1000) |
| 31 |
|
| 32 |
), |
| 33 |
|
| 34 |
# Main panel for displaying outputs ---- |
| 35 |
mainPanel( |
| 36 |
|
| 37 |
# Output: Tabset w/ plot, summary, and table ---- |
| 38 |
tabsetPanel(type = "tabs", |
| 39 |
tabPanel("Plot", plotOutput("plot")), |
| 40 |
tabPanel("Summary", verbatimTextOutput("summary")), |
| 41 |
tabPanel("Table", tableOutput("table")) |
| 42 |
) |
| 43 |
|
| 44 |
) |
| 45 |
) |
| 46 |
) |