Sorting of characters in R. : I have a data frame df, in which I want to sort one column (var) which is a character column. I used the following code:
df$var=order(as.character(df$var))
this line of code runs with no error, but changes the values of the column to numeric data type.