At this point, you are probably wondering what the checkboxInput is for.
This allows the user to choose whether to display a smooth line in the plot. We have done something similar with our first app!
output$corrplot <- renderPlot({
if (input$smooth){
ggplot(data=correlations_by_era,
aes_string(x="era", y=input$feature))+
geom_line()+
labs(title=paste0("Correlation of ",
input$feature ," and the target across era"),
y="Correlation")+
scale_y_continuous(breaks = scales::pretty_breaks(n=10))+
scale_x_continuous(breaks = seq(0, 120, by = 5))+geom_smooth(se=FALSE)
} else {
ggplot(data=correlations_by_era, aes_string(x="era", y=input$feature))+
geom_line()+
labs(title=paste0("Correlation of ", input$feature ," and
the target across era"), y="Correlation")+
scale_y_continuous(breaks = scales::pretty_breaks(n=10))+
scale_x_continuous(breaks = seq(0, 120, by = 5))
}
})