Skip to content

It takes a character string with names separated by comma (e.g. journal's names) and turns them into a table

Usage

string_to_table(x, n, split_regex = ", ?")

Arguments

x

string to split and convert to table

n

number of bucket to create. It will be the number of column in the resulting data.frame

split_regex

defaults to , ?. Pass to split in base::strsplit().

Value

a dataframe of n columns

Details

If the number of elements can't be split equally in the n column, blank cells will be created and all placed in the last column.

Examples

string_to_table(paste(letters, collapse = ", "), 3)
#>   X1 X2 X3
#> 1  a  j  s
#> 2  b  k  t
#> 3  c  l  u
#> 4  d  m  v
#> 5  e  n  w
#> 6  f  o  x
#> 7  g  p  y
#> 8  h  q  z
#> 9  i  r