For dataset, 2014/2015 in EPL.
1. How many referees had participated in the league?
Syntax : distinct(select(datasetname,columnname))
E.g : View(distinct(select(fd,Referee)))
To use this function, however you have to install the dplyr package.
2. How many times did referee 'P Dowd' serve as the referee?
Syntax : nrow(datasetname[datasetname$columnname == 'Column value',])
E.g : nrow(fd[fd$Referee=='P Dowd',])
Ans : 21
A common mistake would be missing out the comma after entering the Column value.
3. How many times did referee 'M Dean' serve as the referee for Arsenal matches?
View(filter(fd,Referee=='P Dowd',fd$HomeTeam=='Arsenal'))
4. Which referee served most number of matches for Chelsea?
Take the list of referees -> find out how many times each referee served for Chelsea when Chelsea played at home and when Chelsea played away.
Work in progress... please let me know if you have a solution
No comments:
Post a Comment