un_separate_rows: factor to character

Description Usage Examples

Description

opposite to separate_rows() from tidyr

Usage

1
un_separate_rows(df, groupingVar, separator)

Examples

 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

jixing475/manuscriptsJX documentation built on April 20, 2020, 9:55 a.m.