You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a reason that the following doesn't demonstrate a more efficient solution?
rv <- reactiveValues(points = cars)
# Same as Solution_05a.R, but instead of keeping
# track of the single most recent point, we accumulate
# all previous points using rbind().
observeEvent(input$click, {
if (!is.null(input$click)) {
thisPoint <- data.frame(
speed = input$click$x,
dist = input$click$y
)
rv$points <- rbind(rv$points, thisPoint)
}
})
output$plot <- renderPlot({
df <- rv$points
plot(df, pch = 19)
model <- lm(dist ~ speed, df)
abline(model)
})
}
As Joe Cheng does, I'd like to recognize that while rbind works fairly quickly usually, it seems like this demonstrates how things could be done slightly more efficiently in general
The text was updated successfully, but these errors were encountered:
Is there a reason that the following doesn't demonstrate a more efficient solution?
As Joe Cheng does, I'd like to recognize that while rbind works fairly quickly usually, it seems like this demonstrates how things could be done slightly more efficiently in general
The text was updated successfully, but these errors were encountered: