encode_dummy function

Encode a given factor variable using dummy variables