vec2mat: Convert a vector with hyphenated names into a matrix.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Convert a vector with hypehnated names into a symmetric matrix with names obtained from vect2mat2(names(x)).

Usage

1
vec2mat(x, sep = "-")

Arguments

x

Either (1) a vector with hyphenated names indicating pairs of factor levels, groups or items that are and are not significantly different or (2) a matrix indicating same. If x is already a matrix, it is checked for symmetry. NAs are not allowed.

sep

"strsplit" character to apply to names(x).

Details

x must have names each of which contains exactly one hyphen; if not, vec2mat issues an error message. If the same comparison is present multiple times, the last value is used; no check is made for duplicates.

Value

A symmetrix matrix of the same class as the input with names obtained from unique(strsplit(names(x))). All nonspecified elements will be 1 if class(x) is numeric, FALSE if logical and "" if character. Used by the functions 'multcompLetters' and 'multcompTs'.

Author(s)

Spencer Graves

See Also

multcompLetters multcompTs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
dif3 <- c(FALSE, FALSE, TRUE)
names(dif3) <- c("a-b", "a-c", "b-c")
vec2mat(dif3)

dif3. <- 1:3
names(dif3.) <- c("a-b", "a-c", "b-c")
vec2mat(dif3.)

dif.ch <- c("this",'is','it')
names(dif.ch) <- c("a-b", "a-c", "b-c")
vec2mat(dif.ch)

vec2mat(array(1, dim=c(2,2)))

multcompView documentation built on May 29, 2017, 10:05 a.m.