I have a dataset that has a FACTOR. Ex: Column Name: Average_Cost_For_Two 800 800 600 When I try to convert the given factor to an integer that values in the Average_Cost_For_Two becomes Ex: Column Name: Average_Cost_For_Two 60 60 52 I am unable to correct this.
Factors are integers with text labels, so direct transformation to integers reveals the existing integer encoding. Therefore, transform first to character before transforming to integer to preserve the observed labelled values.
Quick example for nirgamuk's advice
xx <- as.factor(1:10) yy <- as.numeric(as.character(xx))
@nirgrahamuk Thank you.
@jrkrideau Thank you.
Might you consider picking one of these as the solution and closing the issue for the benefit of the community?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.