Hi friends,
Started with shiny and tutorial by Joe Chang below example
I am unable to get the reason why paste function is used in the lm function.
selected <- reactive({
iris[, c(input$xcol, input$ycol)]
})
model <- reactive({
lm(paste(input$ycol, "~", input$xcol), selected())
})
If i write the code as below it also works is it inefficient.
x<- reactive(iris[,input$xcol])
y<- reactive(iris[,input$ycol])
selected <-reactive(bind_cols(x(),y()))
model <- reactive({
lm((y()~ x()), selected())