my version of chachematrix.R