I wondered if someone could help regarding a set of commands for re-coding an ordinal categorical variable into a dichotomous variable, where the binary values are '1' and '2' rather than '0' and '1'.

Suppose I had a data set called 'trial' and within the data set there were five categorical variables. Call them: 'L', 'M', 'N', 'O', 'P'.

Each of these five variables, has six categories {0,1,2,3,4,5} representing health states (zero meaning no health issues - five representing poor health).

I'd like to take variables (L, M, N, O, P) within the data set 'trial', and dichotomise them so that 1 = {0,1,2}, and 2 = {3,4,5}.

Any help would be much appreciated. The 'sjmisc' package has several dichotomosing functions for splitting into groups; but again this is only zeros/ones.


All guidance would be appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.