Skip to contents

split a column and return a longer tibble

Usage

split_column(df, name_col, value_col, sep = ",")

Arguments

df

tibble

name_col

repeat this as name column

value_col

expand by this value column

sep

separator in the string

Value

expanded tibble

Examples

fancy_count(mini_diamond, cut, ext = clarity) %>%
  split_column(name_col = cut, value_col = clarity)
#> # A tibble: 24 × 2
#>    cut   clarity
#>    <chr> <chr>  
#>  1 Fair  I1(5)  
#>  2 Fair  IF(4)  
#>  3 Fair  SI1(5) 
#>  4 Fair  SI2(4) 
#>  5 Fair  VS1(3) 
#>  6 Fair  VS2(5) 
#>  7 Fair  VVS1(5)
#>  8 Fair  VVS2(4)
#>  9 Good  I1(5)  
#> 10 Good  IF(5)  
#> # ℹ 14 more rows