I am trying to change the class of a column in a dataframe from factor to numeric, however, the values change:
Plot     DWT
1         1.29
2         0.82
3         1.21
4         3.16
Site.copy$DWT<-as.numeric(as.character(Site.copy$DWT))
#or
Site.copy$DWT<-as.numeric(levels(Site.copy$DWT))[as.integer(Site.copy$DWT)]
#Both codes result in this:
Plot     DWT
1        1.290000e+00
2        8.200000e+01
3        1.210000e+00
4        3.160000e+00
How do I fix this?
 
    