Split the title column in several columns

split_title(df, title_col_name, pattern, n_split = "max", lang = NULL)

Arguments

df

a dataframe containing a title column

title_col_name

the column name to be splitted, if missing it will be either TITLE_EN

pattern

the value by default is stored in the package and it is advised to use it, but in some cases it is useful to use one's pattern

n_split

number of new columns, by default the maximum is chosen

lang

by default it returns both the French and the English title provided by INSEE

Value

the same dataframe with the title column splitted

Details

The number of separators in the official INSEE title can vary and is not normalized. Beware all title columns created may not be a cleaned dimension label.

Examples

# \donttest{
library(magrittr)

# quarterly payroll enrollment in the construction sector
data_raw = get_insee_idbank("001577236")
#> 1/1 - Data download & Dataframe build :
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
#> Data cached : /var/folders/4d/0gnh84wj53j7wyk695q0tc_80000gn/T//RtmpLADV6b/797a46473c738b8d386d20866b100aac.rds
#> 

data = data_raw %>%
  split_title()
# }