I would like to number the elements of a vector, assigning \'1\' to the smallest element in the vector. I know how to do this, but my solution (code included below) seems o
More compact version of your program.
dat <- c(5,8,12,12,8,3,100) dat_sorted <- sort(unique(dat)) match(dat,dat_sorted)