encode_SPCA function

Encode a given factor variable using a sparse PCA representation