help me: error renderplotly

Hi,
How do I use function summarise inside of a renderplot?
I tried this way, but can't plot in the dashboard.
The code is:

dados3 <- reactive({
  global %>% 
    select(input$var1, input$var2,ano)%>% 
    rename(Y3var = input$var1, Z3var = input$var2) %>%
    group_by(dados3()$Z3var,ano) %>%
    summarise(Mean = mean(dados3()$Y3var, na.rm = TRUE)) 
})

renderPlotly({
  c<-dados3() %>%
    plot_ly(df, x = ~ano, y=Mean, color =dados3()$Z3var,type="scatter", mode = "line",
            colors = colors) %>%
    layout(xaxis = list(title = "ano"),
           yaxis = list(title = "variável"))
  c
})

and the error is:
Problem with mutate() input ..1.
e[31mxe[39m Problem with mutate() input ..1.
e[31mxe[39m Problem with mutate() input ..1.
e[31mxe[39m Problem with mutate() input ..1.
e[31mxe[39m Problem with mutate() input ..1.
e[31mxe[39m Problem with mutate() input ..1.
(...)

Thanks!

always extremely hard to help without a reprex.
but this is almost certainly a mistake

dados3 <- reactive({
  global %>% 
    select(input$var1, input$var2,ano)%>% 
    rename(Y3var = input$var1, Z3var = input$var2) %>%
    group_by(dados3()$Z3var,ano) %>%
    summarise(Mean = mean(dados3()$Y3var, na.rm = TRUE)) 
})

try

dados3 <- reactive({
  global %>% 
    select(input$var1, input$var2,ano)%>% 
    rename(Y3var = input$var1, Z3var = input$var2) %>%
    group_by(Z3var,ano) %>%
    summarise(Mean = mean(Y3var, na.rm = TRUE)) 
})

Thank you for your reply!

Now the error is:
Error in FUN: 'options' must be a fully named list, or have no names (NULL)

Use rlang::last_error() to try identifying the line of code with the problem.
Orherwise attempt to produce a reprex.

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