title: Rank function is not giving the number "1" to the lowest value
body: <p>I am taking a set of data and attempting to retrieve the lowest value. I believe that the easiest way to do this is by using the rank function followed by the which function to retrieve the lowest value's index.</p>
  
  <p>I'm new so I'm not really sure what else to try, but when I rank the data, it does not rank it properly so that the lowest value is assigned the value of 1.</p>
  
  <pre><code>name_data &lt;- data[2]
  
  state_data &lt;- data[7]
  
  heart_failure_data &lt;- data[17]
  
  heart_failure_data[heart_failure_data == "Not Available"] &lt;- NA
  
  # Remove NA values
  full_data&lt;-heart_failure_data[complete.cases(heart_failure_data),]
  
  full_state&lt;-state_data[complete.cases(heart_failure_data),]
  
  # Only rank data from the given state
  data_by_state &lt;- full_data[full_state==state]
  
  ranking &lt;- rank(data_by_state, ties.method = "first")
  
  top_index &lt;- which(ranking == 1)
  
  name_by_state &lt;- name_data[state_data==state,1]
  
  name_by_state[top_index]
  </code></pre>
  
  <p>For this particular data set, when I read the data, the 42nd value is the lowest (8.1), but the rank function assigns the value 1 to the 71st number (value 10.1). Why is that? Thanks in advance.</p>
  
  <p>Edit: Thanks for the help! As Rui Barradas suggested, my data frame essentially contained the characters of the number (ie "13.1" vice 13.1) which prevented the ranking function from working properly. I used as.numeric(as.character()) to convert the data and I got the expected response. </p>