This is fine from the command line:
data <- mtcars %>% select(cyl, disp, hp) %>% group_by(cyl) %>% summarise (disp = sum(disp), n = n())
but embedded in the following toy app, it generates a subscript out of bounds error, and seems to be generated from group_by:
server.R
library(shiny)
library(dplyr)
library(ggplot2)
data <- mtcars %>% select(cyl, disp, hp) %>% group_by(cyl) %>% summarise (disp = sum(disp), n = n())
shinyServer(function(input, output) {
output$table <- renderTable({
data
})
})
ui.R
shinyUI(
fluidPage(
fluidRow(
tableOutput("table")
)
)
)
Any ideas of what's happening?