R function to map any array of simple type to color #matTools