Skip to contents

Splits each string in a character vector into a fixed number of pieces, returning a character matrix.

Usage

split_max_vlen(x)

Arguments

x

<character> vector

Value

<list> of character vectors

Examples

fruits <- c("apples and oranges and pears and bananas", "pineapples and mangos and guavas")

split_max_vlen(fruits)
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,] "a"  "p"  "p"  "l"  "e"  "s"  " "  "a"  "n"  "d"   " "   "o"   "r"   "a"  
#> [2,] "p"  "i"  "n"  "e"  "a"  "p"  "p"  "l"  "e"  "s"   " "   "a"   "n"   "d"  
#>      [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
#> [1,] "n"   "g"   "e"   "s"   " "   "a"   "n"   "d"   " "   "p"   "e"   "a"  
#> [2,] " "   "m"   "a"   "n"   "g"   "o"   "s"   " "   "a"   "n"   "d"   " "  
#>      [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
#> [1,] "r"   "s"   " "   "a"   "n"   "d"   " "   "b"   "a"   "n"   "a"   "n"  
#> [2,] "g"   "u"   "a"   "v"   "a"   "s"   ""    ""    ""    ""    ""    ""   
#>      [,39] [,40]
#> [1,] "a"   "s"  
#> [2,] ""    ""