I am trying to sort a data frame by a column of numbers and I get an alphanumeric sorting of the digits instead. If the data frame is converted to a matrix, the sorting works.
df[order(as.numeric(df[,2])),]
   V1 V2
1  a  1
3  c 10
2  b  2
4  d  3
> m <- as.matrix(df)
> m[order(as.numeric(m[,2])),]
      V1  V2  
[1,] "a" "1" 
[2,] "b" "2" 
[3,] "d" "3" 
[4,] "c" "10"
 
     
     
    