In Class 2

Author

Sezgi Ayhan

Published

January 10, 2024

library (tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)
library (dplyr)
library (ggplot2)
raw_data <- read.csv("./athlete_events.csv")
#List of gold winners among basketball teams between 1972 and 1980
gold_winner <- raw_data %>%
  filter(Year >= "1972" & Year <= "1980", Sport == "Basketball", Medal == "Gold")
as_tibble(gold_winner)
# A tibble: 60 × 15
      ID Name     Sex     Age Height Weight Team  NOC   Games  Year Season City 
   <int> <chr>    <chr> <int>  <int>  <dbl> <chr> <chr> <chr> <int> <chr>  <chr>
 1  5173 "Michel… M        20    190     77 Unit… USA   1976…  1976 Summer Mont…
 2  8384 "Olga F… F        21    168     67 Sovi… URS   1976…  1976 Summer Mont…
 3  8384 "Olga F… F        25    168     67 Sovi… URS   1980…  1980 Summer Mosk…
 4  9779 "Aleksa… M        20    200    100 Sovi… URS   1972…  1972 Summer Muni…
 5  9783 "Sergey… M        28    190     82 Sovi… URS   1972…  1972 Summer Muni…
 6 10964 "Vida B… F        23    190     91 Sovi… URS   1980…  1980 Summer Mosk…
 7 13017 "Aleksa… M        25    205    105 Sovi… URS   1972…  1972 Summer Muni…
 8 16109 "Willia… M        21    190     92 Unit… USA   1976…  1976 Summer Mont…
 9 18483 "Kennet… M        20    200    102 Unit… USA   1976…  1976 Summer Mont…
10 23251 "Kreimi… M        31    209     94 Yugo… YUG   1980…  1980 Summer Mosk…
# ℹ 50 more rows
# ℹ 3 more variables: Sport <chr>, Event <chr>, Medal <chr>
ggplot(gold_winner, aes(x = Height, y = Weight, color = as.character(Sex))) + geom_point()
Warning: Removed 1 rows containing missing values (`geom_point()`).