0

I have a dataframe with a number of text responses: "completely disagree", "moderately disagree", etc all the way to "completely agree". Seven categories total. Looks like this:

data sheet

I'd like to convert each to a number as follows:

  • "completely disagree" = 1
  • "moderately disagree" = 2
  • "slightly disagree" = 3
  • "neither agree nor disagree" = 4
  • "slightly agree" = 5
  • "moderately agree" = 6
  • "completely agree" = 7

The numbers must be returned as numeric. What's the most efficient way to do this? I've seen responses with numbers to text but not text to numeric numbers that can be added, averaged, etc, without throwing an error.

Am new to R. Many thanks in advance.

glizzard
  • 97
  • 4
  • 1
    You can use `dplyr::recode`. There are lot of options here - https://stackoverflow.com/questions/7547597/dictionary-style-replace-multiple-items – Ronak Shah Nov 11 '20 at 04:34

0 Answers0