Error: Must group by variables found in `.data`. Column `day` is not found. Shiny


I found this error "Must group by variables found in .data. Column day is not found. Shiny"

And this is my code

Montly/daily trend (server) -------------------------------------

output$group_totals <- renderD3({

grouped <- ifelse(input$month != 99, expr(day), expr(month))

 res <- base_electric() %>%

   group_by(month) %>%
   summarise(sum_sales= sum(Amount)) %>%
  group_by(sum_sales, !!grouped) %>%
  tally() %>%
  collect() %>%
    y = sum_sales,
    x = !!grouped
  ) %>%
  select(x, y)

if (input$month == 99) {
  res <- res %>%
      tibble(x = 1:12, label = substr(, 1, 3)),
      by = "x"
} else {
  res <- res %>%
    mutate(label = x) 
r2d3(res, "col_plot.js")


Please help me. I am new in R

Thank you so much


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

p.s. you probably don't have a shiny problem, so I recommend you try to implement your logic in a non-shiny script till you are confident it would work as desired with a view to subsequently translating it into a shiny context once you have mastered the transformations you wish.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.