When I convert a factor to a numeric, the values change to rank values.
R> m$obs
[1] 0 0 1 1 1 1 3 3 3 3 3 3 3 9 9 9 9 9 9 9 9 9 11 11 12 13 13 13 13 13
13 13 14
Levels: 0 1 3 9 11 12 13 14
R> as.numeric(m$obs)
[1] 1 1 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 6 7 7 7 7 7 7 7 8
I have to resort to paste() to get the real values.
R> paste(m$obs)
[1] "0" "0" "1" "1" "1" "1" "3" "3" "3" "3" "3" "3" "3" "9" "9" "9" "9" "9"
"9" "9" "9" "9" "11" "11" "12" "13" "13" "13" "13" "13" "13" "13" "14"
R> as.numeric(paste(m$obs))
[1] 0 0 1 1 1 1 3 3 3 3 3 3 3 9 9 9 9 9 9 9 9 9 11 11 12 13 13 13 13 13
13 13 14
Is there a simpler way to convert a factor to numeric? Thanks!