FixToTable.Rd
Convert a text to a table by using complete columns of spaces (or any other separator) as delimiting point.
FixToTable(txt, sep = " ", delim = "\t", trim = TRUE, header = TRUE)
the text to be partitioned. Works best, if txt is a matrix.
the separator to use. Will frequently be " ".
the new delimiter to insert. (default tab)
logical. Should the separated text be trimmed from whitespace? Defaults to TRUE.
logical. Should the first line be interpreted as header?
Only a complete appearance of the separator character in the same position over all rows will be accepted as column delimiter.
a matrix of the separated text.
# let's get some tabbed text
txt <- matrix(capture.output(Titanic[,,2,1]))
FixToTable(txt[-1,])
#> Class Male Female
#> [1,] "1st" "118" "4"
#> [2,] "2nd" "154" "13"
#> [3,] "3rd" "387" "89"
#> [4,] "Crew" "670" "3"