Skip to contents

For the default split of ", assumes that each element of lines has the same number of characters.

Usage

lines_to_matrix(lines, split = "")

Arguments

lines

a vector

split

character. The string to split the input on. Default is "", i.e. one character per column

Value

A matrix where the number of rows is the length of lines and, for a split on ", the number of columns is the same as the number of characters in each element of lines.

Examples

lines_to_matrix(c("#.#.", "..#.", "##.."))
#>      [,1] [,2] [,3] [,4]
#> [1,] "#"  "."  "#"  "." 
#> [2,] "."  "."  "#"  "." 
#> [3,] "#"  "#"  "."  "."