Import your data

data <- read_excel("../00_data/myData.xlsx")
data
## # A tibble: 236 × 20
##    TEAMID TEAM   PAKE PAKERANK  PASE PASERANK GAMES     W     L WINPERCENT   R64
##     <dbl> <chr> <dbl>    <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl>      <dbl> <dbl>
##  1      1 Abil…   0.7       45   0.7       52     3     1     2      0.333     2
##  2      2 Akron  -0.9      179  -1.1      187     4     0     4      0         4
##  3      3 Alab…  -2.1      211  -2.9      220    10     5     5      0.5       5
##  4      4 Alba…  -0.4      147  -0.3      138     3     0     3      0         3
##  5      6 Amer…  -0.5      160  -0.4      150     3     0     3      0         3
##  6      8 Ariz…  -1.7      206  -2.5      216    28    17    11      0.607    11
##  7      9 Ariz…  -2        209  -1.9      206     5     1     4      0.2       4
##  8     10 Arka…   4.3       11   3.5       16    18    11     7      0.611     7
##  9     11 Arka…   0         76   0         78     1     0     1      0         1
## 10     12 Aubu…   0.6       53   1.4       30    11     7     4      0.636     4
## # ℹ 226 more rows
## # ℹ 9 more variables: R32 <dbl>, S16 <dbl>, E8 <dbl>, F4 <dbl>, F2 <dbl>,
## #   CHAMP <dbl>, TOP2 <dbl>, F4PERCENT <dbl>, CHAMPPERCENT <dbl>
data %>%
    select(GAMES, TEAM, PAKE) 
## # A tibble: 236 × 3
##    GAMES TEAM                 PAKE
##    <dbl> <chr>               <dbl>
##  1     3 Abilene Christian     0.7
##  2     4 Akron                -0.9
##  3    10 Alabama              -2.1
##  4     3 Albany               -0.4
##  5     3 American             -0.5
##  6    28 Arizona              -1.7
##  7     5 Arizona St.          -2  
##  8    18 Arkansas              4.3
##  9     1 Arkansas Pine Bluff   0  
## 10    11 Auburn                0.6
## # ℹ 226 more rows

Pivoting

long to wide form

data %>%

pivot_wider(names_from = GAMES, values_from = PAKE)
## # A tibble: 236 × 56
##    TEAMID TEAM  PAKERANK  PASE PASERANK     W     L WINPERCENT   R64   R32   S16
##     <dbl> <chr>    <dbl> <dbl>    <dbl> <dbl> <dbl>      <dbl> <dbl> <dbl> <dbl>
##  1      1 Abil…       45   0.7       52     1     2      0.333     2     1     0
##  2      2 Akron      179  -1.1      187     0     4      0         4     0     0
##  3      3 Alab…      211  -2.9      220     5     5      0.5       5     3     2
##  4      4 Alba…      147  -0.3      138     0     3      0         3     0     0
##  5      6 Amer…      160  -0.4      150     0     3      0         3     0     0
##  6      8 Ariz…      206  -2.5      216    17    11      0.607    11     7     7
##  7      9 Ariz…      209  -1.9      206     1     4      0.2       4     1     0
##  8     10 Arka…       11   3.5       16    11     7      0.611     7     6     3
##  9     11 Arka…       76   0         78     0     1      0         1     0     0
## 10     12 Aubu…       53   1.4       30     7     4      0.636     4     4     1
## # ℹ 226 more rows
## # ℹ 45 more variables: E8 <dbl>, F4 <dbl>, F2 <dbl>, CHAMP <dbl>, TOP2 <dbl>,
## #   F4PERCENT <dbl>, CHAMPPERCENT <dbl>, `3` <dbl>, `4` <dbl>, `10` <dbl>,
## #   `28` <dbl>, `5` <dbl>, `18` <dbl>, `1` <dbl>, `11` <dbl>, `2` <dbl>,
## #   `29` <dbl>, `6` <dbl>, `26` <dbl>, `15` <dbl>, `8` <dbl>, `7` <dbl>,
## #   `17` <dbl>, `9` <dbl>, `46` <dbl>, `19` <dbl>, `47` <dbl>, `14` <dbl>,
## #   `53` <dbl>, `22` <dbl>, `43` <dbl>, `31` <dbl>, `20` <dbl>, `16` <dbl>, …

wide to long form

data %>%
    pivot_longer('GAMES' : 'PAKE', names_to = "GAMES", values_to = "PAKE")
## # A tibble: 1,180 × 17
##    TEAMID TEAM      W     L WINPERCENT   R64   R32   S16    E8    F4    F2 CHAMP
##     <dbl> <chr> <dbl> <dbl>      <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1      1 Abil…     1     2      0.333     2     1     0     0     0     0     0
##  2      1 Abil…     1     2      0.333     2     1     0     0     0     0     0
##  3      1 Abil…     1     2      0.333     2     1     0     0     0     0     0
##  4      1 Abil…     1     2      0.333     2     1     0     0     0     0     0
##  5      1 Abil…     1     2      0.333     2     1     0     0     0     0     0
##  6      2 Akron     0     4      0         4     0     0     0     0     0     0
##  7      2 Akron     0     4      0         4     0     0     0     0     0     0
##  8      2 Akron     0     4      0         4     0     0     0     0     0     0
##  9      2 Akron     0     4      0         4     0     0     0     0     0     0
## 10      2 Akron     0     4      0         4     0     0     0     0     0     0
## # ℹ 1,170 more rows
## # ℹ 5 more variables: TOP2 <dbl>, F4PERCENT <dbl>, CHAMPPERCENT <dbl>,
## #   GAMES <chr>, PAKE <dbl>

Separating and Uniting

Unite two columns

data %>%
    
    unite(col = "newName", R64:R32, sep = "/", remove = TRUE)
## # A tibble: 236 × 19
##    TEAMID TEAM         PAKE PAKERANK  PASE PASERANK GAMES     W     L WINPERCENT
##     <dbl> <chr>       <dbl>    <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl>      <dbl>
##  1      1 Abilene Ch…   0.7       45   0.7       52     3     1     2      0.333
##  2      2 Akron        -0.9      179  -1.1      187     4     0     4      0    
##  3      3 Alabama      -2.1      211  -2.9      220    10     5     5      0.5  
##  4      4 Albany       -0.4      147  -0.3      138     3     0     3      0    
##  5      6 American     -0.5      160  -0.4      150     3     0     3      0    
##  6      8 Arizona      -1.7      206  -2.5      216    28    17    11      0.607
##  7      9 Arizona St.  -2        209  -1.9      206     5     1     4      0.2  
##  8     10 Arkansas      4.3       11   3.5       16    18    11     7      0.611
##  9     11 Arkansas P…   0         76   0         78     1     0     1      0    
## 10     12 Auburn        0.6       53   1.4       30    11     7     4      0.636
## # ℹ 226 more rows
## # ℹ 9 more variables: newName <chr>, S16 <dbl>, E8 <dbl>, F4 <dbl>, F2 <dbl>,
## #   CHAMP <dbl>, TOP2 <dbl>, F4PERCENT <dbl>, CHAMPPERCENT <dbl>

Seperate a column

data %>%
    
    separate(col = PAKE, into = c("R64","R32"), sep = "/")
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 236 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
## # A tibble: 236 × 19
##    TEAMID TEAM  R64   R32   PAKERANK  PASE PASERANK GAMES     W     L WINPERCENT
##     <dbl> <chr> <chr> <chr>    <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl>      <dbl>
##  1      1 Abil… 0.7   <NA>        45   0.7       52     3     1     2      0.333
##  2      2 Akron -0.9  <NA>       179  -1.1      187     4     0     4      0    
##  3      3 Alab… -2.1  <NA>       211  -2.9      220    10     5     5      0.5  
##  4      4 Alba… -0.4  <NA>       147  -0.3      138     3     0     3      0    
##  5      6 Amer… -0.5  <NA>       160  -0.4      150     3     0     3      0    
##  6      8 Ariz… -1.7  <NA>       206  -2.5      216    28    17    11      0.607
##  7      9 Ariz… -2    <NA>       209  -1.9      206     5     1     4      0.2  
##  8     10 Arka… 4.3   <NA>        11   3.5       16    18    11     7      0.611
##  9     11 Arka… 0     <NA>        76   0         78     1     0     1      0    
## 10     12 Aubu… 0.6   <NA>        53   1.4       30    11     7     4      0.636
## # ℹ 226 more rows
## # ℹ 8 more variables: S16 <dbl>, E8 <dbl>, F4 <dbl>, F2 <dbl>, CHAMP <dbl>,
## #   TOP2 <dbl>, F4PERCENT <dbl>, CHAMPPERCENT <dbl>