I am new to Shiny and learning it's features. Using the mtcars data, I am trying to create a plot whose axis will alter upon user input. When I run the app, I am getting error telling me the "x and y lengths are not the same", so it appears that "data" specified in the plot function is not receiving the mtcars dataframe columns. The plot works property if I replace "data" with any of the columns listed in the server function.
shinyUI(navbarPage("My Application",
tabPanel("Component 1"),
tabPanel("Component 2"),
tabPanel("Component 3",
fluidPage(
fluidRow(
column(4,
"Sidebar",
helpText("This is my longer help text help text."),
selectInput("var",
label = "Choose a variable to display",
choices = c("mpg", "disp", "hp", "qsec"),
selected = "A")
),
column(8,
#style = "background-color:#4d3a7d;",
"Main",
textOutput("selected_var"),
plotOutput("plot1")
)
)
)
),
navbarMenu("More",
tabPanel("Sub-Component A"),
tabPanel("Sub-Component B"))
))
shinyServer(function(input, output) {
data <- reactive({
if("mpg" %in% input$var) return(mtcars$mpg)
if("disp" %in% input$var) return(mtcars$disp)
if("hp" %in% input$var) return(mtcars$hp)
if("qsec" %in% input$var) return(mtcars$qsec)
})
output$selected_var <- renderText({
paste("you have selected", input$var)
})
output$plot1 <- renderPlot({
plot(mtcars$wt, data)
})
})
I figured it out - "data" should have been "data()".
We could also use switch instead of if. Also, in the selected in selectInput, it could be one of the choices. Not sure where "A" is defined
library(shiny)
-ui
ui <- navbarPage("My Application",
tabPanel("Component 1"),
tabPanel("Component 2"),
tabPanel("Component 3",
fluidPage(
fluidRow(
column(4,
"Sidebar",
helpText("This is my longer help text help text."),
selectInput("var",
label = "Choose a variable to display",
choices = c("mpg", "disp", "hp", "qsec"),
selected = "mpg")
),
column(8,
#style = "background-color:#4d3a7d;",
"Main",
textOutput("selected_var"),
plotOutput("plot1")
)
)
)
),
navbarMenu("More",
tabPanel("Sub-Component A"),
tabPanel("Sub-Component B"))
)
-server
server <- function(input, output) {
data <- reactive({
switch(input$var,
mpg = mtcars$mpg,
dist = mtcars$disp,
hp = mtcars$hp,
qsec = mtcars$qsec
)
})
output$selected_var <- renderText({
paste("you have selected", input$var)
})
output$plot1 <- renderPlot({
plot(mtcars$wt, data(), xlab = "wt", ylab = input$var)
})
}
shinyApp(ui = ui, server = server)
-output
Related
I am trying to reference the values of a reactive variable. I have included the code I have so far below. I am referring to "output$var1" below. This app selects the dataset and based on that dataset produces another selectInput to select a variable.
I am able to render the text if I directly type dataset$area (the first variable of the rock dataset). I would like to render something like "dataset$selvar". Is there a way to do this?
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("dataset", label = "Dataset", choices =c("rock","pressure","cars")),
numericInput(inputId = "obs",
label = "Number of observations to view:",
value=10)
),
mainPanel(
verbatimTextOutput("summary"),
tableOutput("table"),
selectInput("inSelect","Select variable", c("Item A", "Item B")),
textOutput("var1")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
datasetInput<-reactive({
switch(input$dataset,
"rock"=rock,
"pressure"=pressure,
"cars"=cars
)
})
output$summary<- renderPrint({
dataset<- datasetInput()
summary(dataset)
})
output$table<- renderTable({
head(datasetInput(), n=input$obs)
})
observe({
dataset<- datasetInput()
varlist<-colnames(dataset)
updateSelectInput(session,"inSelect",
label="Select variable",
choices=varlist,
selected=head(varlist,1)
)
selvar<-updateSelectInput(session,"inSelect",
label="Select variable",
choices=varlist,
selected=head(varlist,1)
)
output$var1<-renderText({
dataset$area
})
})
}
# Run the application
shinyApp(ui = ui, server = server)
When I try dataset$selvar I get "error i ncat: argument 1 (type 'environment') cannot be bandled by 'cat'
Remove the second updateSelectInput from your observer, move your renderText outside of the observer. and inside the renderText use datasetInput()[[input$inSelect]] to display the select column from the selected dataset.
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("dataset", label = "Dataset", choices = c("rock", "pressure", "cars")),
numericInput(
inputId = "obs",
label = "Number of observations to view:",
value = 10
)
),
mainPanel(
verbatimTextOutput("summary"),
tableOutput("table"),
selectInput("inSelect", "Select variable", c("Item A", "Item B")),
textOutput("var1")
)
)
)
server <- function(input, output, session) {
datasetInput <- reactive({
switch(input$dataset,
"rock" = rock,
"pressure" = pressure,
"cars" = cars
)
})
output$summary <- renderPrint({
dataset <- datasetInput()
summary(dataset)
})
output$table <- renderTable({
head(datasetInput(), n = input$obs)
})
observe({
dataset <- datasetInput()
varlist <- colnames(dataset)
updateSelectInput(session, "inSelect",
label = "Select variable",
choices = varlist,
selected = varlist[[1]]
)
})
output$var1 <- renderText({
datasetInput()[[input$inSelect]]
})
}
# Run the application
shinyApp(ui = ui, server = server)
#>
#> Listening on http://127.0.0.1:5275
I have a dataframe with several variables. One of them is continous and the other one is categorical.
I want to obtain wilcoxon test between these two variables, which is basically a metric to compare the difference between two groups of samples.
This is really easy when you know which factors you want to compare.
In base r this is pretty easy with the script:
# Pairwise Wilcox Test allow us to obtain multiple tests at the same time
multiple_wilcox <- function(response, factor) {
pairwise.wilcox.test(response, factor, p.adjust.method = "none")$p.value[, 1]
}
# By default, tests are found against the reference level
with(iris, multiple_wilcox(Sepal.Length, Species))
#> versicolor virginica
#> 8.345827e-14 6.396699e-17
# ... which can be changed with `relevel()`
with(iris, multiple_wilcox(Sepal.Length, relevel(Species, "virginica")))
I would like to implement this in shiny, so I would get all the p-values for a variable selected by the user.
This reactive function should do the work, as it's just the same.
dat <- reactive({
with(data_input(), multiple_wilcox(input$num_var_2, relevel(input$num_var_1, input$selected_factors)))
})
But I'm getting the error:
I don't find where this error is coming from, as the data should be the same.
Here is the RepEx.
# Shiny
library(shiny)
library(shinyWidgets)
library(shinyjqui)
library(shinyjs)
# Data
library(readxl)
library(dplyr)
library(vcd)
# Plots
library(ggplot2)
not_sel <- "Not Selected"
ui <- navbarPage(
tabPanel(
"",
fluidPage(
fluidRow(
sidebarPanel(
title = "Inputs",
fileInput("csv_input", "Select CSV file to import", accept = c(".csv")),
selectInput("num_var_1", "Variable X axis", choices = c(not_sel)),
selectInput("num_var_2", "Variable Y axis", choices = c(not_sel)),
uiOutput("binning"),
br(),
actionButton("run_button", "Run Analysis", icon = icon("play"))
),
# Main panel
mainPanel(
tabsetPanel(
tabPanel(
"Plot",
br(),
verbatimTextOutput("test"),
uiOutput("var_stats"),
br(),
verbatimTextOutput("stats")),
)
)
)
)
)
)
server <- function(input, output){
# Load data and update inputs
data_input <- reactive({
#req(input$csv_input)
#inFile <- input$csv_input
#read.csv(inFile$datapath, 1)
iris
})
observeEvent(data_input(),{
choices <- c(not_sel, names(data_input()))
updateSelectInput(inputId = "num_var_1", choices = choices)
updateSelectInput(inputId = "num_var_2", choices = choices)
})
num_var_1 <- eventReactive(input$run_button, input$num_var_1)
num_var_2 <- eventReactive(input$run_button, input$num_var_2)
output$var_stats <- renderUI({
req(input$num_var_1, data_input())
if (input$num_var_1 != not_sel) {
a <- unique(data_input()[[input$num_var_1]])
pickerInput(inputId = 'selected_factors',
label = 'Select factors',
choices = c(a), selected=a[3], multiple = F,
options = list(`actions-box` = TRUE))
}
})
multiple_wilcox <- function(response, factor) {
pairwise.wilcox.test(response, factor, p.adjust.method = "none")$p.value[, 1]
}
dat <- reactive({
with(data_input(), multiple_wilcox(input$num_var_2, relevel(input$num_var_1, input$selected_factors)))
})
output$test <- renderPrint({
dat()
})
}
# Connection for the shinyApp
shinyApp(ui = ui, server = server)
As relevel() is not working in shiny, you may need to change the factor manually as shown below.
not_sel <- "Not Selected"
ui <- navbarPage(
tabPanel(
"",
fluidPage(
fluidRow(
sidebarPanel(
title = "Inputs",
fileInput("csv_input", "Select CSV file to import", accept = c(".csv")),
selectInput("num_var_1", "Variable X axis", choices = c(not_sel)),
selectInput("num_var_2", "Variable Y axis", choices = c(not_sel)),
uiOutput("binning"),
br(),
actionButton("run_button", "Run Analysis", icon = icon("play"))
),
# Main panel
mainPanel(
tabsetPanel(
tabPanel(
"Plot",
br(),
verbatimTextOutput("test"),
uiOutput("var_stats"),
br(),
verbatimTextOutput("stats")),
)
)
)
)
)
)
server <- function(input, output){
# Load data and update inputs
data_input <- reactive({
#req(input$csv_input)
#inFile <- input$csv_input
#read.csv(inFile$datapath, 1)
iris
})
observeEvent(data_input(),{
choices <- c(not_sel, names(data_input()))
updateSelectInput(inputId = "num_var_1", choices = choices)
updateSelectInput(inputId = "num_var_2", choices = choices)
})
num_var_1 <- eventReactive(input$run_button, input$num_var_1)
num_var_2 <- eventReactive(input$run_button, input$num_var_2)
output$var_stats <- renderUI({
req(input$num_var_1, data_input())
if (input$num_var_1 != "Not Selected") {
a <- as.list(as.character(unique(data_input()[[input$num_var_1]])))
pickerInput(inputId = 'selected_factors',
label = 'Select factors',
choices = list(Factor=a), selected=a[[3]], multiple = F,
options = list(`actions-box` = TRUE))
}
})
multiple_wilcox <- function(response, factor) {
pairwise.wilcox.test(response, factor, p.adjust.method = "none")$p.value[, 1]
}
dat <- eventReactive(input$run_button, {
req(data_input(),input$num_var_1,input$num_var_2,input$selected_factors)
#with(data_input(), multiple_wilcox(input$num_var_2, relevel(input$num_var_1, input$selected_factors)))
df <- data_input()
fac <- unique(data_input()[[input$num_var_1]][data_input()[[input$num_var_1]] != input$selected_factors])
df$new <- data_input()[[input$num_var_1]]
newlevels <- c(input$selected_factors,as.character(fac))
df$new <- factor(df$new, levels=newlevels)
with(df, multiple_wilcox(df[[input$num_var_2]], new))
})
output$test <- renderPrint({
dat()
})
}
# Connection for the shinyApp
shinyApp(ui = ui, server = server)
I am creating a shiny app with some tabs and I am using the shinycssloaders package in order to show a spinner AFTER pressing the actionButton. I saw this post because I was having the same problem... I followed the solution that it was given to the post, but as I my app is different (it has tabPanels, it doesn't work properly, the spinner still apears).
For example, if you click on "Show the plot" in the first tab (selection) and then you want to want to do the log2 transformation o calculate the square root (3rd tab, calculations), before clicking the actionButton the spinner appears and the plot updates. It happens the same when you want to change the titles (2nd tab).
Does anyone know how to fix it?
Thanks very much in advance
The code:
library(shiny)
library(magrittr)
library(DT)
library(ggplot2)
library(shinycssloaders)
new_choices <- setNames(names(mtcars), names(mtcars))
ui <- fluidPage(
# Application title
titlePanel("My shiny app"),
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel("Selection",
selectInput("x_axis", "Choose x axis",
choices = new_choices),
selectInput("y_axis", "Choose y axis",
choices = new_choices),
hr(),
),
tabPanel("Titles",
hr(),
textInput(inputId = "title", "You can write the title:", value = "This is the title"),
textInput(inputId = "xlab", "You can re-name the x-axis:", value = "x-axis...."),
textInput(inputId = "ylab", "You can re-name the y-axis:", value = "y-axis ...."),
),
tabPanel("Calculations",
hr(),
checkboxInput("log2", "Do the log2 transformation", value = F),
checkboxInput("sqrt", "Calculate the square root", value = F),
)
),
actionButton(inputId = "drawplot", label = "Show the plot")
),
# Show a plot of the generated distribution
mainPanel(
# plotOutput("plot")
uiOutput("spinner"),
)
)
)
server <- function(input, output, session) {
data <- reactive({
mtcars
})
filtered_data <- reactive({
data <- data()
if(input$log2 == TRUE){
data <- log2(data+1)
}
if(input$sqrt == TRUE){
data <- sqrt(data)
}
return(data)
})
observeEvent(input$drawplot, {
output$spinner <- renderUI({
withSpinner(plotOutput("plot"), color="black")
})
output$plot <- renderPlot({
Sys.sleep(3)
ggplot() +
geom_point(data = filtered_data(),
aes_string(x = input$x_axis, y = input$y_axis)) +
xlab(input$xlab) +
ylab(input$ylab) +
ggtitle(input$title)
})
})
}
shinyApp(ui, server)
Is it OK like this? I'm not sure to understand all your requirements. To avoid the spinner at the start-up, I use a conditionalPanel. In the server code, I did some changes. It is not recommended to define some output inside an observer.
library(shiny)
library(magrittr)
library(ggplot2)
library(shinycssloaders)
new_choices <- setNames(names(mtcars), names(mtcars))
ui <- fluidPage(
# Application title
titlePanel("My shiny app"),
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel(
"Selection",
selectInput("x_axis", "Choose x axis",
choices = new_choices),
selectInput("y_axis", "Choose y axis",
choices = new_choices),
hr(),
),
tabPanel(
"Titles",
hr(),
textInput(inputId = "title", "You can write the title:", value = "This is the title"),
textInput(inputId = "xlab", "You can re-name the x-axis:", value = "x-axis...."),
textInput(inputId = "ylab", "You can re-name the y-axis:", value = "y-axis ...."),
),
tabPanel(
"Calculations",
hr(),
checkboxInput("log2", "Do the log2 transformation", value = F),
checkboxInput("sqrt", "Calculate the square root", value = F),
)
),
actionButton(inputId = "drawplot", label = "Show the plot")
),
# Show a plot of the generated distribution
mainPanel(
conditionalPanel(
condition = "input.drawplot > 0",
style = "display: none;",
withSpinner(plotOutput("plot"))
)
)
)
)
server <- function(input, output, session) {
data <- reactive({
mtcars
})
filtered_data <- reactive({
data <- data()
if(input$log2 == TRUE){
data <- log2(data+1)
}
if(input$sqrt == TRUE){
data <- sqrt(data)
}
return(data)
})
gg <- reactive({
ggplot() +
geom_point(data = filtered_data(),
aes_string(x = input$x_axis, y = input$y_axis)) +
xlab(input$xlab) +
ylab(input$ylab) +
ggtitle(input$title)
}) %>%
bindEvent(input$drawplot)
output$plot <- renderPlot({
Sys.sleep(3)
gg()
})
}
shinyApp(ui, server)
You need to isolate the expressions that you don't want to trigger the rendering event inside renderPlot
library(shiny)
library(magrittr)
library(DT)
library(ggplot2)
library(shinycssloaders)
new_choices <- setNames(names(mtcars), names(mtcars))
ui <- fluidPage(
# Application title
titlePanel("My shiny app"),
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel("Selection",
selectInput("x_axis", "Choose x axis",
choices = new_choices),
selectInput("y_axis", "Choose y axis",
choices = new_choices),
hr(),
),
tabPanel("Titles",
hr(),
textInput(inputId = "title", "You can write the title:", value = "This is the title"),
textInput(inputId = "xlab", "You can re-name the x-axis:", value = "x-axis...."),
textInput(inputId = "ylab", "You can re-name the y-axis:", value = "y-axis ...."),
),
tabPanel("Calculations",
hr(),
checkboxInput("log2", "Do the log2 transformation", value = F),
checkboxInput("sqrt", "Calculate the square root", value = F),
)
),
actionButton(inputId = "drawplot", label = "Show the plot")
),
# Show a plot of the generated distribution
mainPanel(
# plotOutput("plot")
uiOutput("spinner"),
)
)
)
server <- function(input, output, session) {
data <- reactive({
mtcars
})
filtered_data <- reactive({
data <- data()
if(input$log2 == TRUE){
data <- log2(data+1)
}
if(input$sqrt == TRUE){
data <- sqrt(data)
}
return(data)
})
observeEvent(input$drawplot, {
output$spinner <- renderUI({
withSpinner(plotOutput("plot"), color="black")
})
output$plot <- renderPlot({
Sys.sleep(3)
ggplot() +
geom_point(data = isolate(filtered_data()),
aes_string(x = isolate(input$x_axis), y = isolate(input$y_axis))) +
xlab(isolate(input$xlab)) +
ylab(isolate(input$ylab)) +
ggtitle(isolate(input$title))
})
})
}
shinyApp(ui, server)
Read more about shiny reactivity and isolation: https://shiny.rstudio.com/articles/isolation.html
The code worked only when I added variables and removed for the first time. After I removed that variable, it went back to the select "Add to the plot", then I couldn't add it back, I think when I updated updateSelectInput, there is something wrong. Plus selectRemove needed to remove when it NULL. How I can update by both ways?
library(shiny)
mtcars_1 <- mtcars[,c("mpg", "disp", "hp", "drat", "wt", "qsec")]
runApp(list(
ui=pageWithSidebar(headerPanel("Adding and Removing Variables"),
sidebarPanel(
selectInput(inputId = "selectAdd", label = "Add to the plot",
choices = c(names(mtcars_1)),
selected = names(mtcars_1)[1]),
actionButton(inputId = "add", label = "Add to the plot")
),
mainPanel(
textOutput("text"),hr(),
uiOutput("remove_list")
)
),
server=function(input, output, session) {
rv <- reactiveValues(add_v = c())
observeEvent(input$add,{
rv$add_v <- rbind(rv$add_v,input$selectAdd)
})
rv <- reactiveValues(rem_v = c())
observeEvent(input$remove,{
rv$rem_v <- rbind(rv$rem_v,input$selectRemove)
})
observe({
value_add <- c(names(mtcars_1)[!names(mtcars_1) %in% rv$add_v ],rv$rem_v)
value_rem <-c(rv$add_v[! rv$add_v %in% rv$rem_v])
updateSelectInput(session,"selectAdd",choices = value_add)
updateSelectInput(session,"selectRemove",choices = value_rem)
})
output$remove_list <- renderUI({
if(length(rv$add_v) > 0){
tagList(
selectInput(inputId = "selectRemove", label = "Remove to the plot",
choices = c(rv$add_v),
selected = rv$add_v[1]),
actionButton(inputId = "remove", label = "Remove to the plot")
)
}
})
output$text <- renderText({
c(rv$add_v[! rv$add_v %in% rv$rem_v])
})
}))
Welcome to stackoverflow!
You were almost there - however, your updating logic for the reactiveValues wasn't complete. For each button click you'll have to add an object to one value and remove it from the other. Please check the following:
library(shiny)
mtcars_1 <- mtcars[, c("mpg", "disp", "hp", "drat", "wt", "qsec")]
runApp(list(
ui = pageWithSidebar(
headerPanel("Adding and Removing Variables"),
sidebarPanel(
selectInput(
inputId = "selectAdd",
label = "Add to the plot",
choices = names(mtcars_1),
selected = names(mtcars_1)[1]
),
actionButton(inputId = "add", label = "Add to the plot")
),
mainPanel(textOutput("text"), hr(),
uiOutput("remove_list"))
),
server = function(input, output, session) {
rv <- reactiveValues(add_v = NULL, rem_v = names(mtcars_1))
observeEvent(input$add, {
rv$rem_v <- setdiff(rv$rem_v, input$selectAdd)
rv$add_v <- union(rv$add_v, input$selectAdd)
})
observeEvent(input$remove, {
rv$add_v <- setdiff(rv$add_v, input$selectRemove)
rv$rem_v <- union(rv$rem_v, input$selectRemove)
})
observe({
updateSelectInput(session, "selectAdd", choices = rv$rem_v)
updateSelectInput(session, "selectRemove", choices = rv$add_v)
})
output$remove_list <- renderUI({
if (length(rv$add_v) > 0) {
tagList(
selectInput(
inputId = "selectRemove",
label = "Remove to the plot",
choices = c(rv$add_v),
selected = rv$add_v[1]
),
actionButton(inputId = "remove", label = "Remove to the plot")
)
}
})
output$text <- renderText({
c(rv$add_v[!rv$add_v %in% rv$rem_v])
})
}
))
I am using shiny package in R to take input from user and plot the X and Y variable against each other as line plot.There is no error displayed.Everything is displayed except for the graph.Please can someone help why the graph is not displayed .Here is the ui.r file
library(shiny) # load the shiny package
setwd("C:/indiahacks2")
dat<-read.csv("final.csv")
# Define UI for application
shinyUI(fluidPage(
# Header or title Panel
titlePanel(h4('Impulse Response on VAR MODEL', align = "center")),
# Sidebar panel
sidebarPanel(
selectInput("Impulse", label = "1. Select the Impulse Variable",
choices = names(dat)),
selectInput("Response", label = "1. Select the Response Variable",
choices = names(dat)),
sliderInput("Lag", "2. Select the number of histogram BINs by using the slider below", min=0, max=25, value=10),
radioButtons("colour", label = "3. Select the color of histogram",
choices = c("Green", "Red",
"Yellow"), selected = "Green")
),
# Main Panel
mainPanel(
textOutput("text1"),
textOutput("text2"),
textOutput("text3"),
textOutput("text3"),
plotOutput("myhist")
)
)
)
Server.r
library(shiny) # Load shiny package
dat<-read.csv("final.csv")
shinyServer(
function(input, output) {
output$text1 <- renderText({
colm = as.numeric(input$Impulse)
paste("Impulse Variable is", names(dat[colm]))
})
output$text2 <- renderText({
paste("Color of plot is", input$radio)
})
output$text3 <- renderText({
paste("Number of Lags is", input$Lag)
})
output$text4 <- renderText({
colm = as.numeric(input$Response)
paste("Response Variable is", names(dat[colm]))
})
output$myhist <- renderPlot(
{
colm = as.numeric(input$Impulse)
colm1 = as.numeric(input$Response)
plot(dat[,colm],dat[,colm1])})
})
So there a couple of things wrong with your script, upon further inspection:
1) colm cannot be referenced by output$text4. This is because of scoping...
2) When you comment-out the output$text4 code I now receive an undefined column error in the plot call. This is because forcing your column choices to numeric returns NA.
Below should do what you are looking for.
Here is the server.R code:
library(shiny) # Load shiny package
dat<-read.csv("final.csv")
shinyServer(
function(input, output) {
output$text1 <- renderText({
colm = as.numeric(input$Impulse)
paste("Impulse Variable is", columns()[2])
})
output$text2 <- renderText({
paste("Color of plot is", input$radio)
})
output$text3 <- renderText({
paste("Number of Lags is", input$Lag)
})
output$text4 <- renderText({
colm = as.numeric(input$Response)
paste("Response Variable is", columns()[2])
})
columns<-reactive({
colm = as.character(input$Impulse)
colm1 = as.character(input$Response)
return(c(colm, colm1) )
})
output$myhist <- renderPlot(
{
plot(dat[,columns()[1]],dat[,columns()[2]],type="b")})
})
*Ui.R
# Define UI for application
library(shiny)
shinyUI(fluidPage(
# Header or title Panel
titlePanel(h4('Impulse Response on VAR MODEL', align = "center")),
# Sidebar panel
sidebarPanel(
selectInput("Impulse", label = "1. Select the Impulse Variable",
choices = names(dat)),
selectInput("Response", label = "1. Select the Response Variable",
choices = names(dat)),
sliderInput("Lag", "2. Select the number of histogram BINs by using the slider below", min=0, max=25, value=10),
radioButtons("colour", label = "3. Select the color of histogram",
choices = c("Green", "Red",
"Yellow"), selected = "Green")
),
# Main Panel
mainPanel(
textOutput("text1"),
textOutput("text2"),
textOutput("text3"),
textOutput("text4"),
plotOutput("myhist")
)
)