1

I've imported survey data previously used in SPSS into R and I'm trying to work with them now. I need most variables to be numeric, but haven imports them as labelled variables. Whenever I convert them into numeric variables using the mutate / across function, the variable and value labels get lost.

Most variables have questions like "Do you agree with this statement" and then the answer is on a scale like 1 - strongly disagree to 7 - strongly agree.

So it would be awesome to have them as numeric variables without losing the labels.

Sofia
  • 21
  • 3
  • It is best to convert them into factors. It will solve both the purpose. – Neeraj Nov 25 '22 at 09:41
  • Hi @Neeraj thank you for your quick answer. I have done that, but the problem is, I need most of them to be numeric to do data analysis. – Sofia Nov 25 '22 at 09:47
  • You can convert them into numeric by using `as.integer`. Factors are integers at the core level. – Neeraj Nov 25 '22 at 09:53
  • Otherwise, you can post sample of your data, and what you are trying to do with this. It will help us to give you a specific answer. – Neeraj Nov 25 '22 at 09:54
  • My data is just simple Likert Scales. Like there is a statement and then the answer is on a scale like "strongly agree - strongly disagree". I don't know if I'm allowed to post the data here, because it's not only mine, I'm just working with it. – Sofia Nov 25 '22 at 10:11
  • Okay, but I need them to be numeric in the end. Why would they turn numeric when I put as.integer? – Sofia Nov 25 '22 at 10:11

0 Answers0