I want to change the class of the column of a data frame so that I can correlate values and create graphs. However, when I use the code below, the values change. The original class of "Depth" is factor and I want to change it to numeric. Could anybody explain to me why this happens and if it is posible to change the class without having this problem?
Original Data frame (Site.copy):
Plot Depth
1 1.29
2 0.82
3 1.21
4 3.16
5 12.64
Site.copy$Depth<-as.numeric(as.character(Site.copy$Depth))
Changed Site.copy:
Plot Depth
1 1.290000e+00
2 8.200000e+01
3 1.210000e+00
4 3.160000e+00
5 1.264000e+01