I'm attempting to add another column to a data frame in R, based on the order of values of another variable in the data frame, for which many rows have the same value. So, I would like this new column to essentially be an ordinal version of the previous column, with all the rows that have the same, lowest value in that column assigned 1, and so on. Is there an easy way to do this?
(The data attached here is only the first few rows and does not have any repeats, but the full data set has in total 75 unique values, over 100.000 observations)
… Value
1 0.6215278
2 0.5801653
3 0.5287239
4 0.5267176
5 0.5295736
6 0.5422419
7 0.5269841
8 0.5302013
9 0.5017794
mydata$order <- order(mydata$Value)orderwon't work with the requested tie behavior "all the rows that have the same, lowest value in that column assigned 1". Withorderthere can be only one 1.