OK sorry, I'm new to this. Below is my code. The data set is obtained from the following link
magic <- read.csv("magic.csv")
library(shiny)
library(rsconnect)
magic$class <- factor(magic$class)
magic <- as.data.frame(magic)
ui <- fluidPage(
titlePanel("Telescope measurements by class of radiation"),
sidebarLayout(
sidebarPanel(
selectInput(inputId = "p", label = "Select measurement:",
choices = c("fLength" = "fLength",
"fWidth" = "fWidth",
"fSize" = "fSize",
"fConc" = "fConc",
"fConc1" = "fConc1",
"fAsym" = "fAsym",
"fM3Long" = "fM3Long",
"fM3Trans" = "fM3Trans",
"fAlpha" = "fAlpha",
"fDist" = "fDist" )),
checkboxInput(inputId = "outliers",
label = "Show outliers", TRUE),
checkboxInput(inputId = "notches", label = "Show notches", FALSE)
),
mainPanel(
plotOutput("myplot")
)
)
)
server <- function(input, output, session) {
ghcol <- c("indianred2", "slateblue1")
output$myplot <- renderPlot({
boxplot(magic[,input$p]~magic$class,
names = c("Gamma (Signal)", "Hadron (Background)"),
col = ghcol,
main = paste(input$p),
outline = input$outliers,
xlab = "Radiation Class",
cex.axis = 0.9,
notch = input$notches
)
})
}
shinyApp(ui, server)