Assignment 3 requries to manage a big database, rank hospitals by different factors and apply some complex criteria. To make the principles easier to be understood, I created smaller data frames and functions. There are plenty of ways to solve Assignment 3, and below you find just my suggestions. I'm sure there are better ways to do it.
To run the functions below, you need to download and read these two small csv files: cities.csv citiesNA.csv
- How to order a data frame by the values in its columns
[sort_by_column () and sort_by_columns ()] (https://github.com/DanieleP/PA3-tutorial/blob/master/sortcolumns.md)
- How to manage NA when ordering data frames
- How to order only a specific subset of a data frame
[sort_country()] (https://github.com/DanieleP/PA3-tutorial/blob/master/sortsubset.md)
- How to return a specific ranking after ordering
[find_city_rank() and find_last_city()] (https://github.com/DanieleP/PA3-tutorial/blob/master/rankcity.md)
- How to return a data frame of specific rankings for each subset
[rank_by_country()] (https://github.com/DanieleP/PA3-tutorial/blob/master/rankeachsubset.md)