title: Use apply with table in R
body: <p>I have two variables, one is dependent and another one is independent variable. The dependent variable is <code>x</code> and the independent variable is <code>y</code>. The dependent variable is itself a matrix and it can be iterated as <code>x[,1:n]</code>; same goes for the independent variable .The independent variable can be iterated as <code>y[,1:n]</code>. Now for one single instance of the variable - I would use the table function in R to find ROC like so : <code>table(y[,1], round(x[,1])</code>. I want to use apply function out here so that I can iterate both the variables at the same time - something like <code>apply(ind_var,dep_var,2,function(x,y){x,round(y)})</code> This can easily be done using a for loop - can it be done using <code>apply</code>?</p>
  
  <p>Thanks</p>