Computation of concordant and discordant pairs
These sorts of operations are tough to vectorize because you need to compare every element to all later elements. If the counting operation is a performance bottleneck in your code, then one possibility would be to implement it in C++ using the Rcpp package:

library(Rcpp)
cppFunction(
  "IntegerVector CDcount(NumericVector x, NumericVector y) {
    IntegerVector counts(2, 0);
    int n = x.size();
    for (int i=0; i &lt; n; ++i) {
      for (int j=i+1; j &lt; n; ++j) {
        counts[0] += (x[i] &lt; x[j]) &amp;&amp; (y[i] &lt; y[j]);
        counts[1] += (x[i] &lt; x[j]) &amp;&amp; (y[i] &gt; y[j]);
      }
    }
    return counts;
  }")

pairs2 &lt;- function(x, y) {
  n &lt;- length(x)
  ix &lt;- order(x)
  x &lt;- x[ix]
  y &lt;- y[ix]
  counts &lt;- CDcount(x, y)
  return(list(Nc=counts[1], Nd=counts[2]))
}


For your test data, this results in a 50 times speedup on my system.

x &lt;- runif(10000)
y &lt;- runif(10000)
system.time(pairs(x,y))
#    user  system elapsed 
#   4.892   1.447   6.584 
system.time(pairs2(x, y))
#    user  system elapsed 
#   0.119   0.001   0.120 
identical(pairs(x, y), pairs2(x, y))
# [1] TRUE


The Rcpp package takes some time to compile the CDcount function, so this option is probably only helpful if you are operating on very large vectors or if you are repeating the operation many times.