Import data

# excel file
data <- read_excel("../00_data/PowerRangers.xlsx")
data
## # A tibble: 922 × 7
##    Season          Episode Title `Air Date`          `IMDB Rating` `Total Votes`
##    <chr>             <dbl> <chr> <dttm>                      <dbl>         <dbl>
##  1 Mighty Morphin…       0 The … 1999-05-22 00:00:00           6.7           113
##  2 Mighty Morphin…       1 Day … 1993-08-28 00:00:00           7.4           687
##  3 Mighty Morphin…       2 High… 1993-09-04 00:00:00           6.9           564
##  4 Mighty Morphin…       3 Team… 1993-09-08 00:00:00           7.3           546
##  5 Mighty Morphin…       4 A Pr… 1993-09-09 00:00:00           6.9           535
##  6 Mighty Morphin…       5 Diff… 1993-09-10 00:00:00           6.6           516
##  7 Mighty Morphin…       6 Food… 1993-09-04 00:00:00           7.3           531
##  8 Mighty Morphin…       7 Big … 1993-09-11 00:00:00           6.4           510
##  9 Mighty Morphin…       8 I, E… 1993-09-14 00:00:00           7             504
## 10 Mighty Morphin…       9 For … 1993-09-15 00:00:00           6             494
## # ℹ 912 more rows
## # ℹ 1 more variable: Description <chr>

Filter rows

filter(data)
## # A tibble: 922 × 7
##    Season          Episode Title `Air Date`          `IMDB Rating` `Total Votes`
##    <chr>             <dbl> <chr> <dttm>                      <dbl>         <dbl>
##  1 Mighty Morphin…       0 The … 1999-05-22 00:00:00           6.7           113
##  2 Mighty Morphin…       1 Day … 1993-08-28 00:00:00           7.4           687
##  3 Mighty Morphin…       2 High… 1993-09-04 00:00:00           6.9           564
##  4 Mighty Morphin…       3 Team… 1993-09-08 00:00:00           7.3           546
##  5 Mighty Morphin…       4 A Pr… 1993-09-09 00:00:00           6.9           535
##  6 Mighty Morphin…       5 Diff… 1993-09-10 00:00:00           6.6           516
##  7 Mighty Morphin…       6 Food… 1993-09-04 00:00:00           7.3           531
##  8 Mighty Morphin…       7 Big … 1993-09-11 00:00:00           6.4           510
##  9 Mighty Morphin…       8 I, E… 1993-09-14 00:00:00           7             504
## 10 Mighty Morphin…       9 For … 1993-09-15 00:00:00           6             494
## # ℹ 912 more rows
## # ℹ 1 more variable: Description <chr>

Arrange rows

arrange(data, Season, Episode, `IMDB Rating`)
## # A tibble: 922 × 7
##    Season          Episode Title `Air Date`          `IMDB Rating` `Total Votes`
##    <chr>             <dbl> <chr> <dttm>                      <dbl>         <dbl>
##  1 "Be the first …      NA <NA>  NA                           NA              NA
##  2 "Beast Morpher…       1 Beas… 2019-03-02 00:00:00           9.1            81
##  3 "Beast Morpher…       2 Evox… 2019-03-09 00:00:00           8.8            58
##  4 "Beast Morpher…       3 End … 2019-03-16 00:00:00           8.5            49
##  5 "Beast Morpher…       4 Digi… 2019-03-30 00:00:00           8.7            49
##  6 "Beast Morpher…       5 Taki… 2019-04-06 00:00:00           8.7            44
##  7 "Beast Morpher…       6 Hang… 2019-04-13 00:00:00           8.8            44
##  8 "Beast Morpher…       7 A Fr… 2019-04-20 00:00:00           8.6            42
##  9 "Beast Morpher…       8 The … 2019-04-27 00:00:00           8.8            43
## 10 "Beast Morpher…       9 Silv… 2019-09-14 00:00:00           8.4            32
## # ℹ 912 more rows
## # ℹ 1 more variable: Description <chr>

Select columns

select(data, Season, Episode, `IMDB Rating`)
## # A tibble: 922 × 3
##    Season                    Episode `IMDB Rating`
##    <chr>                       <dbl>         <dbl>
##  1 Mighty Morphin (Season 1)       0           6.7
##  2 Mighty Morphin (Season 1)       1           7.4
##  3 Mighty Morphin (Season 1)       2           6.9
##  4 Mighty Morphin (Season 1)       3           7.3
##  5 Mighty Morphin (Season 1)       4           6.9
##  6 Mighty Morphin (Season 1)       5           6.6
##  7 Mighty Morphin (Season 1)       6           7.3
##  8 Mighty Morphin (Season 1)       7           6.4
##  9 Mighty Morphin (Season 1)       8           7  
## 10 Mighty Morphin (Season 1)       9           6  
## # ℹ 912 more rows

Add columns

mutate(data, `Total Votes`)
## # A tibble: 922 × 7
##    Season          Episode Title `Air Date`          `IMDB Rating` `Total Votes`
##    <chr>             <dbl> <chr> <dttm>                      <dbl>         <dbl>
##  1 Mighty Morphin…       0 The … 1999-05-22 00:00:00           6.7           113
##  2 Mighty Morphin…       1 Day … 1993-08-28 00:00:00           7.4           687
##  3 Mighty Morphin…       2 High… 1993-09-04 00:00:00           6.9           564
##  4 Mighty Morphin…       3 Team… 1993-09-08 00:00:00           7.3           546
##  5 Mighty Morphin…       4 A Pr… 1993-09-09 00:00:00           6.9           535
##  6 Mighty Morphin…       5 Diff… 1993-09-10 00:00:00           6.6           516
##  7 Mighty Morphin…       6 Food… 1993-09-04 00:00:00           7.3           531
##  8 Mighty Morphin…       7 Big … 1993-09-11 00:00:00           6.4           510
##  9 Mighty Morphin…       8 I, E… 1993-09-14 00:00:00           7             504
## 10 Mighty Morphin…       9 For … 1993-09-15 00:00:00           6             494
## # ℹ 912 more rows
## # ℹ 1 more variable: Description <chr>

Summarize by groups

data %>% 
  group_by(Season) %>% 
  summarise(avg_votes = mean(`Total Votes`))
## # A tibble: 28 × 2
##    Season                              avg_votes
##    <chr>                                   <dbl>
##  1 "Be the first one to add a plot.\""      NA  
##  2 "Beast Morphers (Season 1)"              38.5
##  3 "Beast Morphers (Season 2)"              30.2
##  4 "Dino Charge"                            46.9
##  5 "Dino Super Charge"                      32.1
##  6 "Dino Thunder"                           65.2
##  7 "In Space"                              281. 
##  8 "Jungle Fury"                            36.2
##  9 "Lightspeed Rescue"                      85.1
## 10 "Lost Galaxy"                           202. 
## # ℹ 18 more rows