TPD-InternationalFootballRe.../.Rhistory
2019-06-14 18:32:12 +02:00

513 lines
12 KiB
R

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")
shiny::runApp()
test <- getMatchesForTeam("England")
test <- getMatchesForTeam(football_data"England")
test <- getMatchesForTeam(football_data, "England")
test %>% filter(home_team == "England") %>% select(.$home_score) %>% count()
test %>% filter(home_team == "England") %>% select(.$home_score)
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% count(home_score)
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% sum(home_score)
test %>% filter(home_team == "England") %>% summarise(home_score)
test %>% filter(home_team == "England") %>% aggregate(home_score)
test %>% filter(home_team == "England") %>% aggregate(home_score, sum)
test %>% filter(home_team == "England") %>% aggregate(sum)
test %>% filter(home_team == "England") %>% sum(as.numeric(.))
test %>% filter(home_team == "England") %>% sum()
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% select(home_score)
test %>% filter(home_team == "England") %>% select(home_score) %>% sum()
test %>% filter(home_team != "England") %>% select(home_score) %>% sum()
test %>% select(home_score) %>% sum()
home_goals <- test %>% filter(home_team == "England") %>% select(home_score) %>% sum()
away_goals <- test %>% filter(away_team == "England") %>% select(away_score) %>% sum()
goals_scored <- tribble(
~home_goals, ~away_goals, ~overall,
home_goals, away_goals, home_goals + away_goals
)
goals_scored
test %>% filter(home_team == "England") %>% count()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
install.packages("tmap")
install.packages("tmaptools")
install.packages("leaflet")
install.packages(c("leaflet", "tmap", "tmaptools"))
runApp()
data("World")
head(World)
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()