Counting a word frequency in data set


#1

I have a .rds data wich has football team perfomance data in it. I want to select a team and then display how many times it has played a game. Can anyone tell waht is the problem in my code?

library(shiny)
library(shinydashboard)
library(DT)
library(data.table)

data <- readRDS('C:\users\UJJVAL\Desktop\european_soccer.rds');

ui <-

dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(

  box(
    title = "League",
    selectInput("league","selectleague", c(data$home_team, data$away_team),selected = NULL)
  ),
  for (i in 1:20)
  {
    if(data.frame(league=data))
    {
      i++
      sprintf(i)
    }else{}
  }
  DT::dataTableOutput("league")
  )

),
mainPanel(
tableOutput("league")

  )

)

server <- function(input, output) {

output$selected <- DT::renderDataTable({data})

}

shinyApp(ui, server)