title: match() unable to find indexes of values from a dataframe in R
body: <p>In a function with three arguments (i.e. state, outcome and nums) and the data frame is called df.
  Here is the snippet with the issue:</p>
  <pre><code>    else if (num == &quot;worst&quot;){
      da &lt;- as.numeric(unlist(df[,outcome]))
      da &lt;- na.omit(da)
      da &lt;- sort(da, decreasing = T)
      dm &lt;- match(da, df[,outcome])
      print(unique(df[dm, &quot;hospital&quot;]))
    }
  </code></pre>
  <p>the values from <strong>da</strong> printed separately are as follows:</p>
  <pre><code>[1] 19.0 18.4 17.6 17.3 17.3 17.1 17.1 16.8 16.8 16.7 16.6 16.5 16.5 16.4 16.3 16.3 16.3 16.2 16.2 16.2 16.2 16.2 16.2
  [24] 16.2 16.2 16.0 16.0 15.9 15.8 15.8 15.8 15.8 15.8 15.7 15.6 15.6 15.6 15.5 15.4 15.4 15.4 15.3 15.3 15.3 15.3 15.2
  [47] 15.2 15.2 15.1 15.1 15.0 15.0 15.0 14.9 14.9 14.9 14.9 14.8 14.7 14.7 14.7 14.7 14.7 14.6 14.5 14.5 14.3 14.3 14.3
  [70] 14.2 14.2 14.1 14.1 14.1 14.0 14.0 13.8 13.8 13.6 13.5 13.5 13.3 13.2
  </code></pre>
  <p>these values are directly derived from the original df data frame.</p>
  <p>when trying to match the values to extract the indexes using <strong>dm</strong> variable, here is what is returned:</p>
  <pre><code>[1] NA 41 88 14 14 52 52 45 45 58 34 26 26 16  8  8  8  3  3  3  3  3  3  3  3 NA NA 12 36 36 36 36 36 33  9  9  9 60 13
  [40] 13 13 53 53 53 53 44 44 44  4  4 NA NA NA  5  5  5  5 85  7  7  7  7  7 89  2  2 38 38 38 18 18 30 30 30 NA NA 71 71
  [79] 48 23 23 86  1
  </code></pre>
  <p>the issue:
  for example,
  the first value of 19.0 from <strong>da</strong> is not recognized in <strong>dm</strong>, even though that value is derived from the same database of df. Can someone explain me what the issue is and how i can identify the missing variables to retrieve the index values to print specific rows based on the index values.</p>
  <p><strong>NOTE</strong>
  I have already tried to switch to <code>which(x %in% y)</code> method:</p>
  <pre><code>      da &lt;- sort(da, decreasing = T)
        dm &lt;- which(df[,outcome] %in% da)
  
  </code></pre>
  <p>but that just gives this as an output:</p>
  <pre><code>[1]   1   2   3   4   5   7   8   9  10  12  13  14  15  16  17  18  20  22  23  24  25  26  27  30  31  32  33  34  35
  [30]  36  37  38  39  40  41  43  44  45  46  47  48  49  52  53  55  56  57  58  59  60  61  62  63  64  65  66  68  70
  [59]  71  72  73  74  75  77  79  81  83  84  85  86  88  89  91 105 111
  </code></pre>
  <p>Thanks in advance for your help.</p>
  <p>dput link <a href="https://pastelink.net/2e8tm" rel="nofollow noreferrer">https://pastelink.net/2e8tm</a></p>