I am dealing with some factors that are coded as , a-b
, and some are coded as , b-a
. Both are save for my usecase. How do I change such factors to a-b
so that they are consistent.
I could do this using an if-else
statement but I am wondering if there is an efficient way of doing this.
From
Id Col1
101 a-b-c-d
102 a-c-d
103 a-b
104 a-b
105 b-a
106 b-a
107 a-c-b
Expected Results
Id Col1
101 a-b-c-d
102 a-c-d
103 a-b
104 a-b
105 a-b
106 a-b
107 a-c-b