Added funciton for splitting factor to multiple columns according to its occurrences.