stats <- read_csv("../00_data/myData.csv")
## New names:
## Rows: 39 Columns: 8
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (2): Country, ...8 dbl (5): Kill/Death Ratio, Player Rating, Headshot
## Percentage, Kills Per Rou... lgl (1): ...7
## ℹ 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.
## • `` -> `...7`
## • `` -> `...8`
stats <- stats %>%
janitor::clean_names()
stats_small <- stats %>%
select(country, player_impact, player_rating)
stats_wide <- stats_small %>% pivot_wider(names_from = player_impact, values_from = player_rating)
stats_long <- stats_wide %>% pivot_longer(`1.07` : `1.11`, names_to = "player_impact", values_to = "player_rating", values_drop_na = TRUE)
stats_united <- stats %>%
unite(col = "combine", player_impact,player_rating, sep = "/", remove = FALSE)
stats_united %>% separate(col = combine, into = c("player_impact","player_rating", sep = "/"))
## Warning: Expected 3 pieces. Additional pieces discarded in 28 rows [1, 2, 3, 4, 5, 6, 8,
## 9, 11, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, ...].
## # A tibble: 39 × 9
## country kill_death…¹ playe…² playe…³ `/` heads…⁴ kills…⁵ x7 x8
## <chr> <dbl> <chr> <chr> <chr> <dbl> <dbl> <lgl> <chr>
## 1 Argentina 1.03 1 07 1 46.2 0.69 NA Filt…
## 2 Australia 1.05 1 08 1 44.7 0.7 NA <NA>
## 3 Belarus 0.99 1 01 0 48.2 0.67 NA <NA>
## 4 Belgium 1.03 1 05 1 46.9 0.68 NA <NA>
## 5 Brazil 1.07 1 07 1 44.0 0.7 NA <NA>
## 6 Bulgaria 1.03 1 05 1 45.6 0.69 NA <NA>
## 7 Canada 1.01 1 04 1 47.1 0.68 NA <NA>
## 8 China 1.05 1 09 1 48.0 0.71 NA <NA>
## 9 Czech Republic 1.06 1 08 1 46.2 0.7 NA <NA>
## 10 Denmark 1.03 1 04 1 45.8 0.68 NA <NA>
## # … with 29 more rows, and abbreviated variable names ¹kill_death_ratio,
## # ²player_impact, ³player_rating, ⁴headshot_percentage, ⁵kills_per_round