Check compatibility of dimnames

Description

Check that the intersection of dimnames of two arrays are identical.

Usage

1
2
3
dimnames_match(a1, a2)

dimnames_match_(tab1, tab2, verbose = FALSE)

Arguments

a1, a2, tab1, tab2

Arrays with named dimnames.

verbose

Should errors be printed.

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

See Also

is.named.array

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
ar1 = newar(c("a","b"), levels=c(2,3))
ar2 = newar(c("c","a"), levels=c(2,2))
ar1
ar2
## dimension a has levels a1,a2 in both ar1 and ar2.
# Hence we have a match.
dimnames_match(ar1, ar2)

ar1 = newar(c("a","b"), levels=c(2,3))
ar2 = newar(c("c","a"), levels=c(2,3))
ar1
ar2
## dimension a has levels a1,a2 in ar1 and levels a1,a2,a3 in ar2.
# Hence we do not have a match.
dimnames_match(ar1, ar2)

ar2 = newar(c("c","a"), levels=list(c=c("c1","c2"), a=c("a2","a1")))
ar2
## dimension a has levels a1,a2 in ar1 and levels a2,a1 in ar2.
# Hence we do not have a match.
dimnames_match(ar1, ar2)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.