Import your data

powerrangers <- read_csv("../00_data/PowerRangers.csv")
## Rows: 922 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): season, title, air.date, description
## dbl (3): episode, imdb.rating, total.votes
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Pivoting

long to wide form

wide to long form

powerrangers %>%
    pivot_wider(names_from = season, values_from = imdb.rating)
## # A tibble: 922 × 33
##    episode title         air.date total.votes description Beast Morphers (Seas…¹
##      <dbl> <chr>         <chr>          <dbl> <chr>                        <dbl>
##  1      20 Evox Unleash… 12/12/2…          30 Evox final…                    9.4
##  2      19 Source Code   12/5/20…          30 Nate makes…                    9.7
##  3      18 Crunch Time   11/28/2…          21 Devon fall…                    9.1
##  4      17 Fossil Frenzy 11/21/2…          22 When Zoey …                    8.6
##  5      16 The Silva Sw… 11/14/2…          25 Nate and S…                    8  
##  6      15 Goin' Ape     11/7/20…          23 Ravi and R…                    8.7
##  7      14 Golden Oppor… 10/31/2…          26 Nate is re…                    8.5
##  8      13 Grid Connect… 10/24/2…          70 In an epic…                    8.9
##  9      22 Making Bad    10/17/2…          22 Evox decid…                    8.6
## 10      12 Finders Keep… 10/10/2…          29 A hasty de…                    9.4
## # ℹ 912 more rows
## # ℹ abbreviated name: ¹​`Beast Morphers (Season 2)`
## # ℹ 27 more variables: `Beast Morphers (Season 1)` <dbl>,
## #   `Super Ninja Steel` <dbl>, `Ninja Steel` <dbl>, `Dino Super Charge` <dbl>,
## #   `Dino Charge` <dbl>, `Super Megaforce` <dbl>, Megaforce <dbl>,
## #   `Super Samurai` <dbl>, Samurai <dbl>, R.P.M. <dbl>, `Jungle Fury` <dbl>,
## #   `Operation Overdrive` <dbl>, `Mystic Force` <dbl>, S.P.D. <dbl>, …

Separating and Uniting

Separate a column

Unite two columns

powerrangers %>% 
  unite(season, episode, imdb.rating)
## # A tibble: 922 × 5
##    season title              air.date   total.votes description                 
##    <chr>  <chr>              <chr>            <dbl> <chr>                       
##  1 20_9.4 Evox Unleashed     12/12/2020          30 Evox finally executes his m…
##  2 19_9.7 Source Code        12/5/2020           30 Nate makes a horrifying dis…
##  3 18_9.1 Crunch Time        11/28/2020          21 Devon falls victim to a bad…
##  4 17_8.6 Fossil Frenzy      11/21/2020          22 When Zoey accidentally ruin…
##  5 16_8   The Silva Switch   11/14/2020          25 Nate and Steel accidentally…
##  6 15_8.7 Goin' Ape          11/7/2020           23 Ravi and Roxy's anniversary…
##  7 14_8.5 Golden Opportunity 10/31/2020          26 Nate is reunited with his d…
##  8 13_8.9 Grid Connection    10/24/2020          70 In an epic battle, the Beas…
##  9 22_8.6 Making Bad         10/17/2020          22 Evox decides to add a new v…
## 10 12_9.4 Finders Keepers    10/10/2020          29 A hasty decision by Zoey pu…
## # ℹ 912 more rows

Missing Values