I had converted a scale variable into a factor in order to facilitate the visualisation of some data. The variable was Individual/Couple Annual Income (JntInc), and I converted it into a factor of 31 levels.
However, I wish to reconvert it back into a factor since I would like to do a correlation matrix along with some other variables which are numeric. Therefore I would like to ask if this is possible?
I have attached a sample of the data set with two variables: Alcohol Units Per Week (drating) and the annual income one.
I thank you in advance for your time and help. If there are changes that need to be made in the example I included, please inform me and I will do it immediately.
df <- data.frame(drating = c(0, -2, -2, 18.2125, 3.587, 0, -2, 0, 0, 0, -2, -2, 1.7155, 0.116, -2, -2, 0.058, 4.5, 0.808, 0.145), JntInc = c(3L, 3L, 3L, 19L, 19L, 19L, 19L, 8L, 18L, 18L, 18L, 18L, 21L, 21L, 21L, 21L, 6L, 6L, 19L, 19L))
Created on 2019-04-09 by the reprex package (v0.2.1)