I am trying to make my first Shiny, and I am struggling to correct the following error messages:
Warning in xy.coords(x, y, xlabel, ylabel, log) :
NAs introduced by coercion
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Error in plot.window(...) : need finite 'ylim' values
Here is a reprex of the code I have written. I would greatly appreciate any tips.
library(shiny)
library(ggplot2)
library(readxl)
RB <- read_excel("RB.xlsx")
ui<-fluidPage(
titlePanel("Runningback Shiny Project"),
sidebarLayout(sidebarPanel(
selectInput(inputId= "Conference",
label="Conference",
sort(unique(RB$Conference)),
multiple=T),
selectInput(inputId = "Year",
label="Draft Year",
sort(unique(RB$Year)),
multiple=T),
selectInput(inputId = "Round",
label="Round",
sort(unique(RB$Rnd)),
multiple=T),
selectInput(inputId= "x_axis_variable",
label="X Axis Variable",
choices =c(RB[2,3,5,12:19,21:33]),
min("x_axis_variable"=1, na.rm = T),
max("x_axis_variable"=10000, na.rm = T),
multiple=F,
selected=RB$`40 Yard`),
selectInput(inputId = "y_axis_variable",
label="Y Axis Variable",
choices =c(RB[2,3,5,7:10,12:19,21:50]),
min("y_axis_variable"=1, na.rm = T),
max("y_axis_variable"=10000, na.rm = T),
multiple=F,
selected=RB$`Rush Yds`)),
mainPanel(
plot("scatterplot"), height= "750px",
plot.window(xlim = 1,10000, ylim = 1,10000, log="x,y", asp=NA),
),
))
server<-function(input,output) {
output$scatterplot<-renderPlot({
expr
width = "auto"
height = "auto"
res = 72
validate(
need(input$x_axis_variable != input$y_axis_variable)
)
})
}
shinyApp(ui = ui, server = server)