In [25]:
library("XML")
library("methods")
library("dplyr")
library("tidyr")
Read the player data
In [26]:
playersFinalData <- read.csv(file="player.csv", header=TRUE, sep=",")
Read the team data
In [27]:
teamFinalData <- read.csv(file="team.csv", header=TRUE, sep=",")
Display the data
In [28]:
head(playersFinalData)
Display the data
In [29]:
head(teamFinalData)
Qn) Which are the top 10 players by overall rating?
In [30]:
topPlayer = tbl_df(playersFinalData) %>% select(player_name,overall_rating) %>% top_n(10) %>% arrange(desc(overall_rating))
In [31]:
head(topPlayer,n=10)
Qn) Which are the top 10 goalkeepers by sum of gk attributes?
In [32]:
topGoalKeeper = tbl_df(playersFinalData) %>% select(player_name,gk_rating) %>% top_n(10) %>% arrange(desc(gk_rating))
In [33]:
head(topGoalKeeper,n=10)
Qn) Which are the top 10 players by number of appearances (with any team they played with)?
In [34]:
topAppearances = select(playersFinalData,player_name,appearances) %>% top_n(10) %>% arrange(desc(appearances))
In [35]:
head(topAppearances,n=10)
Qn) Which are the top 10 players by number of leagues they played in?
In [36]:
topLeagueAppearances = select(playersFinalData,player_name,league_appearances) %>% top_n(10) %>% arrange(desc(league_appearances))
In [37]:
head(topLeagueAppearances,n=10)
Qn) Which are the top 10 teams by sum of build up play attributes?
In [38]:
topBuildUpTeam = tbl_df(teamFinalData) %>% select(team_long_name,build_up_play) %>% top_n(10) %>% arrange(desc(build_up_play))
In [39]:
head(topBuildUpTeam,n=10)
Qn) Which are the top 10 teams by sum of chance creation attributes?
In [40]:
topChanceCreationTeam = tbl_df(teamFinalData) %>% select(team_long_name,chance_creation) %>% top_n(10) %>% arrange(desc(chance_creation))
In [41]:
head(topChanceCreationTeam,n=10)
Qn) Which are the top 10 teams by sum of defense attributes?
In [42]:
topDefenseTeam = tbl_df(teamFinalData) %>% select(team_long_name,defense) %>% top_n(10) %>% arrange(desc(defense))
In [43]:
head(topDefenseTeam,n=10)
Qn) Which are the top 10 teams by number of scored goals?
In [44]:
topGoalScoringTeams = teamFinalData %>% select(team_long_name,goals) %>% top_n(10) %>% arrange(desc(goals))
In [45]:
head(topGoalScoringTeams,n=10)
In [ ]: