object of type 'closure' is not subsettable when FILTERING tydeverse

I have a login screen to input user and pass. I want to keep the user id and use it as a filter parameter. Cant do it.. Please, some help.

resumo <- data.frame(
  IDSIMULADO = c("300", "300","300"), # mandatory
  MATRICULA = c("6162", "6100","6150"), # mandatory
  QTDACERTO = c("71","77","81")
  stringsAsFactors = FALSE

# define some credentials
credentials <- data.frame(
  user = c("6162", "shinymanager"), # mandatory
  password = c("123", "12345"), # mandatory
  stringsAsFactors = FALSE


ui <- fluidPage(
  tags$h2("My secure application")

# Wrap your UI with secure_app
ui <- secure_app(ui)

server <- function(input, output, session) {
  # call the server part
  # check_credentials returns a function to authenticate users
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)

  #filter some data using res_auth$user
  dados <- resumo  %>% filter(MATRICULA==res_auth$user,IDSIMULADO==300) 
  output$acertos <- renderValueBox({
      paste0(dados$QTDACERTO[1]), "Questoes corretas", icon = icon("check"),
      color = "purple"

shinyApp(ui, server)

I dont see any library() for dplyr or tidyverse so you are probably using stats::filter() which you don't intend.
Try dplyr::filter

Dear friend, thank you.

i will try to be more clear. sorry.

On server, res_auth gave 5 values. one of its values: res_auth$user

I want to store this value to use in this filter:

dados <- resumo %>% filter(MATRICULA==res_auth$user,IDSIMULADO==300)

it never came out

If res_auth is a reactive then to read values from it I'd expect res_auth()user

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.