Converting a factor to numeric without losing information R (as.numeric() doesn't seem to work) [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: R - How to convert a factor to an integer\numeric in R without a loss of information The following fact about the as.numeric() function has been brought to my attention > blah<-c("4","8","10","15") > blah [1] "4" "8" "10" "15" > blah.new<-as.factor(blah) > blah.new [1] 4 8 10 15 Levels: 10 15 4 8 > blah.new1<-as.numeric(blah.new) > blah.new1 [1] 3 4 1 2 When I convert a factor with levels 4, 8, 10, and 15 to a