1. Set up a github account and create a repository called DSCI101.

Here is the link to my repository: https://github.com/paladidnt/DSCI101

2.

(a) How many total games have the Cubs won and lost between 1876 and 2022?

cubs <- read.csv("https://raw.githubusercontent.com/gjm112/DSCI101/main/data/cubs_all_time.csv")
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0      ✔ purrr   1.0.1 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.5.0 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(mdsr)
CubsWin <- cubs %>% select(W)
sum(CubsWin$W)
## [1] 11141
CubsLoss <- cubs %>% select(L)
sum(CubsLoss$L)
## [1] 10592

Between 1876 and 2022 the Cubs have won 11,141 games and lost 10,592 games

(b) What year did the Cubs score the most runs? What year did the Cubs score the fewest runs? Do you have any thoughts about the year that the Cubs scored the fewest runs?

cubsRuns <- cubs%>% select(R, Year)
cubsRunsPos <- arrange(cubsRuns, desc(R))
cubsRunsNeg <- arrange(cubsRuns, R)
cubsRunsPos[1,]
##      R Year
## 1 1056 1894
cubsRunsNeg[1,]
##     R Year
## 1 265 2020

The Cubs scored the most runs in 1894 with 1056 runs. They scored the fewest in 2020 with 265 runs. The drasticaly smaller number in 2020 was most likely due to covid cutting the baseball season, as well as many other things, short.

(c) In how many seasons was the Cubs total attendance (i.e. the variable Attendance) over 3 million?

cubs %>% select(Attendance, Year) %>% filter(Attendance > 3000000)
##    Attendance Year
## 1     3094865 2019
## 2     3181089 2018
## 3     3199562 2017
## 4     3232420 2016
## 5     3017966 2011
## 6     3062973 2010
## 7     3168859 2009
## 8     3300200 2008
## 9     3252462 2007
## 10    3123215 2006
## 11    3099992 2005
## 12    3170154 2004

The Cubs total attendance was over 3 million in 12 seperate seasons: 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2016, 2017, 2018, & 2019

(d) In the years between 1982 and 2000 (inclusive), what was the greatest ratio of runs for (R) to runs against (RA) in a single season?

cubsRatioSimple <- cubs %>% filter(2001 > Year) %>% filter(Year > 1981) %>% select( Year, R, RA)
cubsRatioFINAL <- cubsRatioSimple %>% mutate(ratio = R/RA) %>% arrange(desc(ratio))
cubsRatioFINAL[1,]
##   Year   R  RA    ratio
## 1 1984 762 658 1.158055

Between 1982 and 2000 the greatest ratio of run to runs against in a single season occurred in 1984 with a ratio of 1.1580547

3.

(a) How many colleges in this data set are in Illinois?

college <- read.csv("https://raw.githubusercontent.com/gjm112/DSCI101/main/data/top_colleges_2022.csv")
college %>% select(organizationName, state) %>% filter(state == "IL")
##                             organizationName state
## 1                    Northwestern University    IL
## 2                      University of Chicago    IL
## 3   University of Illinois, Urbana-Champaign    IL
## 4          University of Illinois at Chicago    IL
## 5           Illinois Institute of Technology    IL
## 6                  Loyola University Chicago    IL
## 7                       Wheaton College (IL)    IL
## 8                  Illinois State University    IL
## 9                          DePaul University    IL
## 10                        Bradley University    IL
## 11                       Lake Forest College    IL
## 12              Illinois Wesleyan University    IL
## 13                          Lewis University    IL
## 14                         Principia College    IL
## 15                         Augustana College    IL
## 16 Southern Illinois University Edwardsville    IL

There are 16 total colleges in this data set that are in Illinois.

(b) Find the undergraduate student population of Loyola University Chicago.How many colleges in this data set have a larger undergraduate student population than Loyola University Chicago?

college %>% select(organizationName, undergradPop) %>% filter(organizationName == "Loyola University Chicago")
##            organizationName undergradPop
## 1 Loyola University Chicago        13878
college %>% select(organizationName, undergradPop) %>% filter(undergradPop > 13878)
##                                             organizationName undergradPop
## 1                         University of California, Berkeley        33208
## 2                      University of California, Los Angeles        33641
## 3                                 University of Pennsylvania        14202
## 4                                         Harvard University        14431
## 5                                         Cornell University        15396
## 6                        University of California, San Diego        32252
## 7                          University of Southern California        21757
## 8                            University of California, Davis        33181
## 9                          University of Michigan, Ann Arbor        32146
## 10                                     University of Florida        37975
## 11                 University of North Carolina, Chapel Hill        20215
## 12                                    University of Virginia        19253
## 13                          University of California, Irvine        32111
## 14                         University of Washington, Seattle        39514
## 15                  University of Illinois, Urbana-Champaign        36277
## 16                           Georgia Institute of Technology        17602
## 17                   University of California, Santa Barbara        25004
## 18                      University of Maryland, College Park        32954
## 19                               University of Texas, Austin        42419
## 20                          University of Wisconsin, Madison        35038
## 21                     Texas A&M University, College Station        56517
## 22                                         Boston University        22674
## 23                                  Brigham Young University        35850
## 24                                         Purdue University        36989
## 25                                       New York University        29633
## 26                              George Washington University        13980
## 27                                San Diego State University        33077
## 28                                     University of Georgia        32702
## 29                               Binghamton University, SUNY        15293
## 30                                      CUNY, Baruch College        18794
## 31                                  Florida State University        36789
## 32                      University of Minnesota, Twin Cities        46135
## 33                  North Carolina State University, Raleigh        28869
## 34                                 University of Connecticut        20501
## 35                    California State University, Fullerton        40436
## 36                                   Northeastern University        19769
## 37                   California State University, Long Beach        35933
## 38                                 Michigan State University        42294
## 39                                             Virginia Tech        30324
## 40                       University of California, Riverside        23848
## 41                              Stony Brook University, SUNY        24056
## 42                      University of California, Santa Cruz        18761
## 43                                        University of Utah        29205
## 44                                     University at Buffalo        24445
## 45                           Indiana University, Bloomington        34790
## 46                                        Rutgers University        40730
## 47  California Polytechnic State University, San Luis Obispo        21736
## 48                         University of Illinois at Chicago        23451
## 49                                       Syracuse University        29745
## 50                           University of Colorado, Boulder        34026
## 51                                 San Jose State University        29870
## 52                                     University of Houston        42607
## 53                                        Clemson University        22100
## 54                                Louisiana State University        27753
## 55                        University of Tennessee, Knoxville        24949
## 56                               University of South Florida        45587
## 57                             University of Central Florida        68814
## 58                          Florida International University        61869
## 59                               University of Texas, Dallas        22409
## 60                        CUNY, The City College of New York        15220
## 61                           Arizona State University, Tempe        69024
## 62                                      CUNY, Hunter College        20665
## 63                                     University of Arizona        38556
## 64                                    University of Delaware        21869
## 65                                         Auburn University        26235
## 66                                        University of Iowa        25755
## 67                                  James Madison University        21818
## 68                                   George Mason University        35884
## 69                            San Francisco State University        28789
## 70           California State Polytechnic University, Pomona        27785
## 71                          University of Missouri, Columbia        24146
## 72                  California State University, Los Angeles        24240
## 73                            University of Oklahoma, Norman        23736
## 74                                      University of Oregon        20402
## 75                                     Texas Tech University        34272
## 76                                     Iowa State University        29246
## 77                                   Oregon State University        30839
## 78                              University of South Carolina        29221
## 79                                         Baylor University        14614
## 80                                      University of Kansas        21552
## 81                   California State University, Northridge        36736
## 82                                         Drexel University        17108
## 83                       California State University, Fresno        23528
## 84                                      CUNY, Queens College        20521
## 85                                     Ohio State University        49971
## 86                                 University of Nevada-Reno        19231
## 87                                    University of Arkansas        24838
## 88                               Washington State University        28930
## 89                      University of Massachusetts, Amherst        27365
## 90                                    University of Kentucky        24633
## 91                                    CUNY, Brooklyn College        17946
## 92                                         Temple University        30861
## 93                                  University of Pittsburgh        24935
## 94                   California State University, Sacramento        32212
## 95                        California State University, Chico        17604
## 96                                         Towson University        21684
## 97                   Colorado State University, Fort Collins        28641
## 98                                  University of Cincinnati        32766
## 99                         Rochester Institute of Technology        14744
## 100                            Western Washington University        16791
## 101                              Florida Atlantic University        31632
## 102                              University of Hawaii, Manoa        15160
## 103                          University of Nebraska, Lincoln        26359
## 104                    California State University, East Bay        15329
## 105                                University of Mississippi        19151
## 106                         Virginia Commonwealth University        24766
## 107                                    Miami University (OH)        18113
## 108                               University of Rhode Island        17724
## 109                                Oklahoma State University        21688
## 110                                    Utah State University        29335
## 111                               St. John's University (NY)        18131
## 112                   California State University-San Marcos        15621
## 113                  University of North Carolina, Charlotte        27636
## 114                                         Rowan University        18638
## 115              California State University, San Bernardino        19454
## 116                                Illinois State University        19798
## 117                                 University of Louisville        18045
## 118                                University of North Texas        36663
## 119                                        DePaul University        16134
## 120                                  Kansas State University        18417
## 121                                    University of Alabama        35872
## 122                               University at Albany, SUNY        15185
## 123                               Montclair State University        18661
## 124                           University of Colorado, Denver        20717
## 125                              University of North Florida        17574
## 126                                     CUNY, Lehman College        17112
## 127               CUNY, John Jay College of Criminal Justice        16900
## 128                             Appalachian State University        18679
## 129                          University of Nevada, Las Vegas        28841
## 130                             Mississippi State University        20288
## 131                           University of Texas, Arlington        43756
## 132              California State University-Dominguez Hills        16449
## 133                       University of Massachusetts Boston        15054
## 134                            Pennsylvania State University        84202
## 135                      University of Alabama at Birmingham        14969
## 136                            University of Nebraska, Omaha        14138
## 137                                 West Virginia University        23061
## 138                      University of Missouri, Saint Louis        15549
## 139                       University of Massachusetts Lowell        16869
## 140                           Brigham Young University-Idaho        58767
## 141                                Portland State University        24062
## 142                                 Georgia State University        32742
## 143                  West Chester University of Pennsylvania        15885
## 144       Indiana University-Purdue University, Indianapolis        24230
## 145                              Northern Arizona University        29070
## 146                                   Texas State University        37202
## 147                       University of Texas at San Antonio        31261
## 148                 University of North Carolina, Wilmington        17001
## 149                            Florida Gulf Coast University        15446
## 150                                       Oakland University        18047
## 151                                          Ohio University        23910
## 152                             University of Texas, El Paso        24745
## 153                   University of Texas, Rio Grande Valley        35593
## 154                            Grand Valley State University        23127
## 155                                    Ball State University        17636
## 156                                 Montana State University        16214
## 157                                Kennesaw State University        39961
## 158                                 East Carolina University        25249
## 159                                 University of New Mexico        18683
## 160                           CUNY, College of Staten Island        14247
## 161                              University of North Georgia        22283
## 162          Embry-Riddle Aeronautical University, Worldwide        15867
## 163                                   Wayne State University        20110
## 164                                  Old Dominion University        22182
## 165                  University of Colorado Colorado Springs        14006
## 166                 University of North Carolina, Greensboro        18332
## 167                             Sam Houston State University        20652
## 168                                    University of Memphis        20011

The undergraduate student population of Loyola University Chicago is 13,878 students.There are 168 other colleges in this data set with a larger undergraduate student population then Loyola.

(c) Find the college that is the furthest north. Repeat this for south, east, and west. Comment on anything interesting that you find.

North <- college %>% select(organizationName, latitude) %>% arrange(desc(latitude))
North[1,]
##                organizationName latitude
## 1 Western Washington University 48.75235
South <- college %>% select(organizationName, latitude) %>% arrange(latitude)
South[1,]
##              organizationName latitude
## 1 University of Hawaii, Manoa 21.29937
West <- college %>% select(organizationName, longitude) %>% arrange(longitude)
West[1,]
##              organizationName longitude
## 1 University of Hawaii, Manoa   -157.82
East <- college %>% select(organizationName, longitude) %>% arrange(desc(longitude))
East[1,]
##                     organizationName longitude
## 1 Tennessee Technological University   85.5016

Western Washington University is the furthest north college. University of Hawaii, Manoa is the furthest south & east. Tennessee Technological University is the furthest west. It is interesting to note that the university in Hawaii was both furthest east & south