opposite to separate_rows() from tidyr
1 | un_separate_rows(df, groupingVar, separator)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(magrittr)
data.frame(
stringsAsFactors = FALSE,
player = c("Allan Houston", NA, "Latrell Sprewell", NA, NA),
teams = c(
"Pistons", "Knicks", "Warriors", "Knicks",
"Timberwolves"
),
position = c("Shooting guard", NA, "Small forward", NA, NA)
) %>%
manuscriptsJX::un_separate_rows(groupingVar = player, separator = ", ")
#> # A tibble: 2 x 3
#> player teams position
#> <chr> <chr> <chr>
#> 1 Allan Houston Pistons, Knicks Shooting guard
#> 2 Latrell Sprewell Warriors, Knicks, Timberwolves Small forward
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.