text: user1749: I have done some genome scan analysis and I want to identify the outlier loci. For an expected value of the FRD equal to q = 10, a list of candidate loci can be obtained by using the Benjamin-Hochberg procedure as follows:
  q=0.1
  L = length(adjusted.p.values)
  W = which(sort(adjusted.p.values) < q * (1:L) / L)
  candidates = order (adjusted.p.values)[w]
  
  and this is part of the outliers and my output
  head(candidates)
   [1]  3  4  9   10  13 
  
  But I need the output in a different type.
  I want to assign TRUE if a locus has been chosen as outlier and FALSE if it has not 
    head (desired_output)
  
    [1] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE
  
  Any idea how can I modify the Code?
  
  user29: As Devon said, removing the which will give you W as a logical vector that can be used to index the sorted p-values. To get a logical vector that can be used to subset the original (unsorted) values you’ll need to go a step further:
  candidates = is.element(1 : L, order(adjusted.p.values)[W])
  
  However, I’m not sure this will work with your data: the name adjusted.p.values suggests that these values are already FDR-adjusted. So you cannot/should not perform additional correction on them. If they are already adjusted, then you can get candidate loci simply by
  candidates = adjusted.p.values < q
  
  
original_text: 1749: <p>I have done some genome scan analysis and I want to identify the outlier loci. For an expected value of the FRD equal to q = 10, a list of candidate loci can be obtained by using the Benjamin-Hochberg procedure as follows:</p>
  
  <pre><code>q=0.1
  L = length(adjusted.p.values)
  W = which(sort(adjusted.p.values) &lt; q * (1:L) / L)
  candidates = order (adjusted.p.values)[w]
  </code></pre>
  
  <p>and this is part of the outliers and my output</p>
  
  <pre><code>head(candidates)
   [1]  3  4  9   10  13 
  </code></pre>
  
  <p>But I need the output in a different type.
  I want to assign TRUE if a locus has been chosen as outlier and FALSE if it has not </p>
  
  <pre><code>  head (desired_output)
  
    [1] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE
  </code></pre>
  
  <p>Any idea how can I modify the Code?</p>
   29: <p>As Devon said, removing the <code>which</code> will give you <code>W</code> as a logical vector that can be used to index the <em>sorted</em> p-values. To get a logical vector that can be used to subset the original (unsorted) values you’ll need to go a step further:</p>
  
  <pre><code>candidates = is.element(1 : L, order(adjusted.p.values)[W])
  </code></pre>
  
  <p>However, I’m not sure this will work with your data: the name <code>adjusted.p.values</code> suggests that these values are <em>already</em> FDR-adjusted. So you cannot/should not perform additional correction on them. If they are already adjusted, then you can get candidate loci simply by</p>
  
  <pre><code>candidates = adjusted.p.values &lt; q
  </code></pre>
  