The package does not have functionality to calculate a permutation matrix. The underlying R idiom is easy. Given a permutation p in word form, then
M <- matrix(0,size(p),size(p))
M[cbind(seq_len(size(p)),unclass(p)[1,])] <- 1
M
and this should work, although only for single permutations. Note that as.matrix.word() does something different, and this fact should be documented in permutation.Rd.
The package does not have functionality to calculate a permutation matrix. The underlying R idiom is easy. Given a permutation
p
in word form, thenand this should work, although only for single permutations. Note that
as.matrix.word()
does something different, and this fact should be documented inpermutation.Rd
.