title: how to rank values in a vector and give them corresponding values?
body: <p>Now I'm doing it by looping trhough a sorted vector, but maybe there is a faster way using internal R functions, and maybe I don't even need to sort. </p>
  
  <pre><code>vect = c(41,42,5,6,3,12,10,15,2,3,4,13,2,33,4,1,1)
  vect = sort(vect)
  print(vect)
  outvect = mat.or.vec(length(vect),1)
  outvect[1] = counter = 1
  for(i in 2:length(vect)) {
      if (vect[i] != vect[i-1]) { counter = counter + 1 }
      outvect[i] = counter
  }
  
      print(cbind(vect,outvect))
  
   vect outvect
   [1,]    1       1
   [2,]    1       1
   [3,]    2       2
   [4,]    2       2
   [5,]    3       3
   [6,]    3       3
   [7,]    4       4
   [8,]    4       4
   [9,]    5       5
  [10,]    6       6
  [11,]   10       7
  [12,]   12       8
  [13,]   13       9
  [14,]   15      10
  [15,]   33      11
  [16,]   41      12
  [17,]   42      13
  </code></pre>
  
  <p>The code is used to make charts with integers on the X axis instead of real data because for me distance between the X values is not important.
  So in my case the smallest x value is always 1. and the largest is always equal to how many X values are there.</p>
  
  <p>-- edit: due to some misuderstanding about my question I added self sufficient code with output.</p>