I have imported a dataset made with SPSS (.sav file) using read.sav(). The main problem occurs when I want to work with factor variables that have been coded numerically (1 represents a, 2 represents b, and so on) in SPSS. When using attributes, it shows: "haven_labelled" "vctrs_vctr" "double",
I have tried the haven: as.factor function to turn these variables in specific columns into factors. However, in that process, the labels will be lost, and when I use the attributes function again, it shows only the codes (1, 2, 3 and .. without their labels). Also, in some instances, I get the error that the variable cannot turn into a factor. How can i turn these "haven_labelled" variables into factor variables without loosing their categories ( even if it means i will only see the categories instead of their designated code?