0

I am working with the AddHealth dataset and I need to turn some variables into one. For example, I need to combine the numbers 1 and 2 and say that both numbers represent the number one, for each of my columns.

I want to turn this

H1RP1
1- Strongly Agree
2- Agree 
3- Neither
4- Disagree 
5- Strongly Disagree

Into this

1- Strongly Agree+Disagree
2-Neither
3-Disagree + Strongly Disagree 

How can I do that? Thank you in advance!

rawr
  • 20,481
  • 4
  • 44
  • 78
  • 1
    look into `fct_record`, `record`, `factor_record` etc functions in tidyverse – Onyambu May 16 '22 at 20:47
  • `factor` with duplicated labels: `factor(x, c('1- Strongly Agree', '2- Agree', '3- Neither', '4- Disagree', '5- Strongly Disagree'), c('1- Strongly Agree+Disagree', '1- Strongly Agree+Disagree', '2-Neither', '3-Disagree + Strongly Disagree', '3-Disagree + Strongly Disagree'))` – rawr May 16 '22 at 20:53

0 Answers0