runApp() runApp() runApp() View(football_data) runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() View(football_data) getMatchesList("England", "Scotland", football_data) getMatchesList("England", "Scotland", football_data) %>% arrange() getMatchesList("England", "Scotland", football_data) %>% arrange(decreasing=TRUE) getMatchesList("England", "Scotland", football_data) %>% arrange(.,decreasing=TRUE) getMatchesList("England", "Scotland", football_data) %>% arrange(.$date) getMatchesList("England", "Scotland", football_data) %>% arrange(.$date, decreasing=TRUE) getMatchesList("England", "Scotland", football_data) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% sort(date) getMatchesList("England", "Scotland", football_data) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% sort(date, decreasing = TRUE) football_data %>% select(date) football_data %>% select(date) %>% min() football_data %>% select(date) %>% format(date, "%Y") football_data %>% select(date) %>% format(.$date, "%Y") football_data %>% select(date) %>% typeof() football_data %>% select(date) %>% format(as.Date(date, format="%Y-%m-%d"),"%Y") test <- football_data %>% select(date) test[1] test %>% head(1) test %>% head(1) %>% format(., "%Y") test %>% head(1) %>% typeof test %>% head(1) %>% typeof() football_data %>% select(date) %>% min() football_data %>% select(date) football_data %>% select(date) %>% aggregate(., by=list(.), max) football_data %>% min(.$date) football_data %>% select(date) %>% summarise(min = min(date)) football_data %>% select(date) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% summarise(min = min(date)) football_data %>% select(date) %>% mutate(. = as.Date(date, "%Y-%m-%d")) %>% summarise(min = min(.)) football_data %>% select(date) %>% mutate(. = as.Date(., "%Y-%m-%d")) %>% summarise(min = min(.)) getDateFromData <- function(matchesData) { return( matchesData %>% select(date) %>% mutate(date = as.Date(date, "%Y-%m-%d")) ) } getDateFromData(football_data) %>% summarise(max = max(date)) balance <- football_data %>% count(winner, sort = TRUE) return(balance) runApp() getDateFromData(football_data) runApp() runApp() runApp() runApp() typeof(min_date_from) getDateFromData(football_data) %>% summarise(min = min(date)) %>% as.Date() getDateFromData(football_data) %>% summarise(min = min(date)) %>% as.Date(., format = "%Y-%m-%d") getDateFromData(football_data) %>% summarise(min = min(date)) %>% as.Date(date, format = "%Y-%m-%d") getDateFromData(football_data) %>% summarise(min = min(date)) %>% as.Date(date) getDateFromData(football_data) %>% summarise(min = min(date)) %>% strptime(date, "%Y-%m-%d") getDateFromData(football_data) %>% summarise(min = min(date)) %>% strptime(., "%Y-%m-%d") getDateFromData(football_data) %>% summarise(min = min(date)) getDateFromData(football_data) %>% summarise(min = min(date)) %>% top_n(1) getDateFromData(football_data) %>% summarise(min = min(date)) %>% top_n(1) %>% typeof runApp() getDateFromData(football_data) %>% summarise(min = min(date)) %>% slice(1) getDateFromData(football_data) %>% summarise(min = min(date)) %>% pull() runApp() getDateFromData(football_data) %>% summarise(min = min(date)) %>% pull() %>% typeof() getDateFromData(football_data) %>% summarise(min = min(date)) %>% pull() %>% as.Date(., format = "%Y-%m-%d") getDateFromData(football_data) %>% summarise(min = min(date)) %>% pull() %>% as.Date(., format = "%Y-%m-%d") %>% typeof() test <- getDateFromData(football_data) %>% summarise(min = min(date)) %>% pull() as.Date(test, "%Y-%m-%d") as.Date(test, "%Y-%m-%d") %>% typeof() test <- as.Date(test, "%Y-%m-%d") typeof(test) as.character(test) test <- as.character(test) test typeof(test) test <- as.Date(test, "%Y-%m-%d") test typeof(test) runApp() runApp() runApp() runApp() runApp() runApp() runApp() test_date <- as.Date("2000-01-01", "%Y-%m-%d") football_data %>% filter(as.Date(as.character(date, "%Y-%d-%m")) >= test_date) runApp() football_data %>% filter(as.Date(as.character(date, "%Y-%d-%m")) >= as.Date(as.character(test_date, "%Y-%d-%m")) & as.Date(as.character(date, "%Y-%d-%m")) <= as.Date(as.character(max_date_to, "%Y-%d-%m"))) football_data %>% filter(as.Date(as.character(date, "%Y-%d-%m")) >= as.Date(as.character(test_date, "%Y-%d-%m"))) runApp() install.packages("lubridate") runApp() runApp() dateFrom <- as.Date(as.character(dateFrom, "%Y-%m-%d")) runApp() as_date(test) test_date <- as_date(test) test_date typeof(test_date) runApp() runApp() runApp() football_data %>% filter(as_date(date) >= test_date) runApp() getMatchesList <- function(matchesData, first_team, second_team) { return( matchesData %>% filter(home_team %in% c(first_team, second_team) & away_team %in% c(first_team, second_team)) %>% arrange() ) } getMatchesList(football_data, "England", "Scotland") getMatchesList(football_data, "England", "Scotland") %>% filterByDate(min_date_from, max_date_to) runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() View(football_data_ext) runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() install.packages("shinydashboard") runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() shiny::runApp() runApp() runApp() runApp() runApp() runApp() balanceBetweenTeams(input, output) runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() install.packages("scales") install.packages("scales") shiny::runApp() runApp() runApp() runApp() runApp() install.packages("scales") runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() shiny::runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() c(home_teams$home_team, away_teams$away_team) %>% unique() c(home_teams$home_team, away_teams$away_team) c(home_teams, away_teams) c(home_teams, away_teams) %>% unique() runApp() full_join(home_teams, away_teams) %>% unique() left_join(home_teams, away_teams, by = home_teams$"home_team" == away_teams$"away_team") home_teams %>% full_join(away_teams) home_teams %>% full_join(away_teams, by = .$home_team == away_teams$away_team) home_teams %>% full_join(away_teams, by = .$home_team == away_teams$home_team) home_teams away_teams as.list(home_teams) mapply(home_teams, away_teams, SIMPLIFY = false) merge.data.frame(home_teams, away_teams) merge.data.frame(as.data.frame(home_teams), as.data.frame(away_teams)) merge(home_teams, away_teams) merge(home_teams$home_team, away_teams$away_team) home_teams %>% mutate(home_team = away_team) shiny::runApp() runApp() runApp() rlang::last_error() teams <- home_teams + away_teams teams pd.concat() library(pandas) install.packages("pandas") home_teams[away_teams] test <- merge(home_teams, away_teams, c("home_team", "away_team")) head(home_teams) as.list(home_teams) test <- as.list(home_teams) test2 <- as.list(away_teams) test + test2 merge(home_teams, away_teams, home_teams$home_team, away_teams$away_team) merge(home_teams, away_teams, by.x = "home_team", by.y = "away_team") merge(home_teams, away_teams, by.x = "home_team", by.y = "away_team") %>% unique() merge(home_teams, away_teams, by.x = "home_team", by.y = "away_team") runApp() runApp() runApp() runApp() runApp() tournament_types <- football_data %>% select(tournament) %>% unique() tournament_types runApp() football_data %>% select(tournament) %>% unique() %>% as.list() runApp() as.vector(football_data$tournament) football_data$tournament %>% unique() %>% as.vector() runApp() tournament_types <- football_data %>% pull(tournament) tournament_types tournament_types %>% unique() runApp() runApp() runApp() runApp() install.packages("shinywidgets") runApp() install.packages("shinyWidgets") runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() football_data %>% select("home_team") %>% unique() %>% sort() football_data %>% select("home_team") %>% unique() football_data %>% select("home_team") %>% unique() %>% arrange(home_teams) football_data %>% select("home_team") %>% unique() %>% arrange("home_team") football_data %>% select("home_team") %>% unique() %>% arrange(., "home_team") football_data %>% select("home_team") %>% unique() %>% arrange("home_team") football_data %>% select("home_team") %>% unique() %>% arrange() football_data %>% select("home_team") %>% arrange("home_team") %>% unique() football_data %>% select("home_team") %>% arrange(., "home_team") %>% unique() football_data %>% select("home_team") %>% arrange(.$home_team) %>% unique() runApp() # Prepare data home_teams <- football_data %>% select("home_team") %>% unique() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() install.packages("gganimate") runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() git status runApp() getFilteredResultsForTeam(input) getMatchesForTeam(football_data, "England") %>% filterByDate(as_date(input$date_range[1]), as_date(input$date_range[2])) getMatchesForTeam(football_data, "England") runApp() runApp() getBalanceForTeam <- function(football_data, team) { balance <- football_data %>% count(winner, sort = TRUE) return(balance) } getBalanceForTeam(football_data = football_data, "England") getBalanceForTeam(football_data = getMatchesForTeam("England"), "England") getMatchesForTeam("England") getMatchesForTeam(football_data, "England") getBalanceForTeam(football_data = getMatchesForTeam(football_data, "England"), "England") test <- getBalanceForTeam(football_data = getMatchesForTeam(football_data, "England"), "England") test2 <- test[!(test$winner !%in% c("England", "Draw"))] test2 <- test[!(test$winner %in% c("England", "Draw"))] test2 <- test[!(test$winner == "England")] test2 <- test[(test$winner == "England")] test2 <- test[!(test$winner == "England"),] head(test2) test2 <- test[!(test$winner %in% c("England", "Draw")),] head(test2) sum(test[!(test$winner %in% c("England", "Draw")),]) sum(test[!(test$winner %in% c("England", "Draw")),]$n) football_data[!(football_data$winner %in% c("England", "Draw")),]$n test[!(test$winner %in% c("England", "Draw")),]$n test[!(test$winner %in% c("England", "Draw")),] test[(test$winner %in% c("England", "Draw")),] runApp() runApp() # Tab 1 matchesForTeam(input, output) runApp() getBalanceForTeam <- function(football_data, team) { balance_full <- football_data %>% count(winner, sort = TRUE) balance <- football_data[(football_data$winner %in% c(team, "Draw")),] other_sum <- sum(football_data[!(football_data$winner %in% c(team, "Draw")),]$n) balance <- balance %>% rbind(c("Other", other_sum)) return(balance) } runApp() runApp() head(test) runApp() test <- getMatchesForTeam(football_data, "England") balance_full <- test %>% count(winner, sort = TRUE) head(balance_full) test_bal <- balance_full[(balance_full$winner %in% c("England", "Draw"))] test_bal <- balance_full[(balance_full$winner %in% c("England", "Draw")),] head(test_bal) other_sum <- sum(balance_full[!(balance_full$winner %in% c("England", "Draw")),]$n) other_sum balance <- balance %>% rbind(c("Other", other_sum)) test_bal <- test_bal %>% rbind(c("Other", other_sum)) head(test_bal) runApp() runApp() runApp() runApp() runApp() runApp() runApp() test_bal runApp() test <- getMatchesForTeam(football_data, "Abkhazia") balance_full <- test %>% count(winner, sort = TRUE) head(balance_full) runApp() balance_full balance test_bal <- balance_full[(balance_full$winner %in% c("England", "Draw")),] other_sum <- sum(balance_full[!(balance_full$winner %in% c("Abkhazia", "Draw")),]$n) test_bal <- balance_full[(balance_full$winner %in% c("Abkhazia", "Draw")),] balance <- test_bal %>% rbind(c("Other", other_sum)) balance str(balance[3]) str(balance) balance <- test_bal %>% rbind(c("Other", as.numeric(other_sum))) str(balance) balance <- test_bal %>% rbind(c("Other", as.integer(other_sum))) str(balance) runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() runApp() version() version packageVersion("shiny")