I've been trying to create custom graphs in my Shiny Project, but there is error occuring :
> Warning in model.response(mf, "numeric") : NAs introduced by coercion
> Error in contrasts<-(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
> contrasts can be applied only to factors with 2 or more levels
Here is the code :
observeEvent(input$create_cutom_graph, {
output$cutom_graph <- reactive(renderPlot(
plot(input$graph_X,input$graph_Y),
abline(lm(input$graph_X~input$graph_Y)),
title(input$graph_X,"i",input$graph_Y)
))
}
))
The way it is supposed to work is that you choose from the dropdown menu which data should be on the X axis and then you do the same with Y axis,
then you click the button "Create" and it does the trick but somehow it doesnt.
And i have to also stress that I've tried to apply function na.omit
before the data like : na.omit(input$graph_X)
still it does not do the trick.
Thanks anyways for your help!