rregressionscalelikert

Factor variable to Likert Scale - how to convert properly


I've collected the data on participation and identity. I used a web-survey (via Google Forms), and there are some problems with data conversion for my regression...

My variable where I used the Likert Scale (strongly disagree - 1, strongly agree - 5) is a factor-level variable. My purpose is to convert it to numeric. For instance, the value «Agreed» should be assesed as 5, and so on.

I used droplevels() function to remove unused levels, then I used as.numeric(). But the problem is that the numeric levels do not correspond to Likert Scale. For example, due to alphabetic order in R, Difficult to answer has the value 1. Which is methodologically wrong.

So, could anyone tell me hints how to convert my data properly, please?


Solution

  • Making an example

    levels <- as.factor(c("agree", "disagree", "strongly agree", "strongly disagree", "neutral"))
    

    Factor levels are alphabetic, as indicated

    [1] agree             disagree          strongly agree    strongly disagree
    [5] neutral 
    

    Relevel with factor

    levels <- factor(levels, c("strongly disagree", "disagree", "neutral", "agree", "strongly agree"))
    

    Convert to numeric with as.numeric

    as.numeric(levels)
    levels
    [1] 4 2 5 1 3