Convert all factors to string variables

I'm sorry for not having reprex but using that in my question is pointless.
How can I convert all factor variables in my data frame into string variables?
I don't know what advantage of factor values is but exporting data to SPSS using foreign package is painful as every factor value is listed in the SPSS syntax (hundreds of lines). This problem dues not exist with string variables.
I've tried this (simply listing variables I want to convert) but no cusses:

Service.car.data <- Service.car.data %>% 
  toString(DealerCode, DealerName.x, Model, VIN, ZoneRegion, CRM_PERSON_UID, DealerName.y, Accountnum, Event.Date, RoDate)

Is it possible to convert all factors into strings?

1 Like

You can use data %>% mutate_if(is.factor, as.character)

You should also look into the haven package and its write_sav function.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.