I am using below code to lean Shiny R , when i run this code, it gives me this error:
Warning: Error in hist.default: 'x' must be numeric [No stack trace available]
library(shiny)
ui <- fluidPage(
selectInput("Ind","Indipendent Variable",choices = names(mtcars)),
selectInput('Dep',' Dependent Variable',choices = names(mtcars)),
plotOutput("BoxPlot"),
plotOutput('Hist'))
server <- function(input, output, session) {
data1 <- reactive({input$Ind})
data2 <- reactive({input$Dep})
output$BoxPlot <- renderPlot({boxplot(get(data2()) ~ get(data1()) , data=mtcars)})
output$Hist <- renderPlot({hist(get(data1())})
}
shinyApp(ui, server)
any help why would it say so ?