I have a Shiny app that's doing with a server and ui function like this:
df<- read_csv(path_here)
ui <- fluidPage(
# App title ----
titlePanel("Histograms!"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
checkboxGroupInput("Company",
"Company",
choices = unique(df$Company)
),
checkboxGroupInput("predicted_condition",
"Predicted Condition",
choices = unique(df$Predicted.Condition)
)
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Histogram ----
plotOutput(outputId = "distPlot")
)
)
)
server<- function( input, output, session){
reactive_data <- reactive({
df %>%
filter(Company %in% input$Company)%>%
filter(Predicted.Condition %in% input$Predicted_Condition)%>%
select(Predicted.Probability)
})
output$distPlot <- renderPlot({
hist(reactive_data())
})
}
Basically I'm making a histogram where the user can use check boxes called Company and Predicted_Condition. Their selections would filter the corresponding columns in my df, then I'd make a histogram of the probabilities left in the Predicted.Probability column.
However, when I run this I get an error that says x must be numeric even though I've checked that the Predicted.Probability column is numeric. Any suggestions on what to do here?
dput()to help you. - YBSselectalways returns a dataframe, usepullto get a vector. Without seeing example data, it's hard to tell where the breaks error comes from - starjadputon myPredicted.Probabilitycolumn. The last few entries were:0.000703995, 0.000594523, 0.000214589, 0.000145538, 0.00028317, 0.000564918, 0.000354667, 0.000280292, 0.000117386, 0.000207468, 0.000323793, 0.011153646)Running summary on the column yields aminof0.0001and amaxof1.0000, but I'm still getting invalid number of breaks error - lvnwrth