title: Random ordered sample without replacement in R
body: <p>The function RandomKSubsets from <a href="https://www.math.upenn.edu/~wilf/eastwest.pdf" rel="nofollow noreferrer">https://www.math.upenn.edu/~wilf/eastwest.pdf</a>
  draws an ordered subset without replacement from a set of numbers. </p>
  
  <p>`</p>
  
  <pre><code>RandomKSubsets:=proc(n,k)
  local rno,east,west ;
  if n&lt;0 or k&lt;0 or k&gt;n then RETURN()
      elif n=0 and k=0 then RETURN([])
      else
  rno:=10^(-12)*rand();
  if rno&lt;k/n then
      east:=RandomKSubsets(n-1,k-1);
      RETURN([op(east),n])
          else
      west:=RandomKSubsets(n-1,k);
      RETURN(west)
  fi;fi;
  end:
  </code></pre>
  
  <p>`</p>
  
  <p>Is there a package in R that does the same thing? Or can somebody help with translating it into R?</p>