{"cells":[{"metadata":{"_uuid":"051d70d956493feee0c6d64651c6a088724dca2a","_execution_state":"idle","trusted":true},"cell_type":"code","source":"library(tidyverse) # metapackage with lots of helpful functions","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Read in team names."},{"metadata":{"trusted":true},"cell_type":"code","source":"teams <- read_csv(\"../input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MTeams.csv\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Read in tournament seeds and extract region and seeds. For first four teams, add 0.5 to seed (for simplicity)."},{"metadata":{"trusted":true},"cell_type":"code","source":"tourney_seeds <- read_csv(\"../input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MNCAATourneySeeds.csv\") %>% \n    extract(Seed, c(\"Region\", \"Seed\", \"Pair\"), \"([WXYZ])(\\\\d\\\\d)([ab]?)\", convert = TRUE) %>% \n    mutate(Seed = if_else(Pair != \"\", Seed + 0.5, Seed + 0.0)) %>% \n    select(-Pair)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Read in overall seeds."},{"metadata":{"trusted":true},"cell_type":"code","source":"overall_seeds <- read_csv(\"../input/march-madness-overall-seeds-men/MNCAAOverallSeeds.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"total_seeds <- tourney_seeds %>% \n    inner_join(overall_seeds, by = c(\"Season\", \"TeamID\"))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Let's make some kind of comparison between regional seeds and overall seeds and see if there are any obvious large differences between regions."},{"metadata":{"trusted":true},"cell_type":"code","source":"total_seeds %>% \n    ggplot(aes(x = Seed, y = OverallSeed, color = Region)) +\n    geom_point() +\n    geom_smooth(method = \"lm\", se = FALSE) +\n    facet_wrap(~ Season)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Nothing really stands out."},{"metadata":{"trusted":true},"cell_type":"code","source":"total_seeds %>% \n    group_by(Season, Region) %>% \n    summarize(AverageSeed = mean(OverallSeed)) %>% \n    arrange(Season, AverageSeed)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Full list of overall seeds (for checking)"},{"metadata":{"trusted":true},"cell_type":"code","source":"named_seeds <- overall_seeds %>% \n    inner_join(teams, by = \"TeamID\") %>% \n    select(Season, TeamName, TeamID, OverallSeed) %>% \n    arrange(Season, OverallSeed)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"named_seeds","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Save table to CSV for external checking."},{"metadata":{"trusted":true},"cell_type":"code","source":"named_seeds %>% write_csv(\"NamedOverallSeeds.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"R","language":"R","name":"ir"},"language_info":{"mimetype":"text/x-r-source","name":"R","pygments_lexer":"r","version":"3.4.2","file_extension":".r","codemirror_mode":"r"}},"nbformat":4,"nbformat_minor":1}