Dear All,

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.

https://cran.r-project.org/web/packages/sjmisc/vignettes/recodingvariables.html

All guidance would be appreciated,

Best,

Andrew