Hi, I want to display the count of rows of a data frame in the HTML
The ui variable is set like this:
ui <- fluidPage(
textOutput("games_count"),
tableOutput("df_games_today"),
)
my server function is this:
server <- function(input, output, session) {
dataset_games <- reactive({
dataset_games <- dbGetQuery(con, query_games_today)
})
output$df_games_today <- renderTable({
dataset_games()
})
output$games_count <- renderText({
dataset_games <- dbGetQuery(con, query_games_today)
games_count <- nrow(dataset_games)
})
}
Is there a way to get the nrow for the data frame "df_games_today" without having to run the dbGetQuery twice? Total newbie here to shiny so I apologize in advance. I'm former web developer that is now a data engineer and I'm working hard on figuring out this R syntax.