2/6/2018

Uruguayan National Football Team

With Russia Football World Cup beginning this month, is important to evaluate the history of the Uruguayan National Football Team to built an idea of the possibilities of win the tournament.

The app Uruguayan National Football Team allow the user to analyse the performance of the Uruguayan National Football Team in relation to the different opponents along history.

You can visit the app in: https://fcomesana.shinyapps.io/DSS9_assignment3

The data base

The data base was created by the author of the app and is storage in this Google Drive document

In the app, the data is downloaded with this code:

library(readr)
data <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vTsY7BAkn46IMx6-Dnpd8rIX4pJe7-T2avTI2U-F57Cijh1QE6paeXgPT8ZdjYU0r1HtDiDkn_V-1DO/pub?gid=2104791270&single=true&output=csv", col_type = cols())

This is an example of the first rows of the data base:

## # A tibble: 3 x 6
##   fecha      contrincante resultado  gano empato perdio
##   <date>     <chr>        <chr>     <int>  <int>  <int>
## 1 1901-05-16 Argentina    Lose          0      0      1
## 2 1902-07-20 Argentina    Lose          0      0      1
## 3 1903-09-13 Argentina    Win           1      0      0

The filters

The user can filter the data by a range of dates that can be provided or by a a selection of opponents.

For this example, we suppose the user selected the period of time from 2005-01-01 to 2018-05-31. And the opponents are Argentina, Brazil, Paraguay, Chile, Bolivia, Peru, Ecuador, Colombia, Venezuela, and Mexico.

This is the code used to filter this selection:

selection <- data %>%
    filter(fecha >= "2005-01-01",
           fecha <= "2018-05-31",
           contrincante %in% c("Argentina", "Brasil", "Paraguay", 
                               "Chile", "Bolivia", "Peru", "Ecuador", 
                               "Colombia", "Venezuela", "Mexico"))

The outcomes

The final result is the visualization of the data in two plots. One of them is the agregation of the matches grouped by results and the other one is the evolution of the results year by year.

This is an example of the first plot in the selection defined in the previous section: