vec2mat2.RdConvert a vector of hyphenated names into a character matrix with 2 columns containing the names split in each row.
vec2mat2(x, sep = "-")A character matrix with rownames = x and with the character string preceding the "sep" character in the first column and the character string following the "sep" character in the second column.
If each element of x does not contain exactly 1 "sep" character, an error is issued.
vec2mat2(c("a-b", "a-c", "b-c"))
#> [,1] [,2]
#> a-b "a" "b"
#> a-c "a" "c"
#> b-c "b" "c"
vec2mat2(c("a-b", "b-a"))
#> [,1] [,2]
#> a-b "a" "b"
#> b-a "b" "a"
#> Error in vec2mat2(c("a", "b-a", "b-c")) :
#> Names must contain exactly one '-' each; instead got a, b-a, b-c
#> Error in vec2mat2(c("a-c", "b-a", "b-c-d")) :
#> Names must contain exactly one '-' each; instead got a-c, b-a, b-c-d