title: R - lm and r squared
body: <p>I have been running through the questions on this site and others and I just want to make sure I understand that I am going this correctly and then I will want some advice to analyse the results.</p>
  
  <p>I am exporting a m by n binary matrix from Java to R (using jri) and then I want to run lm() against an expected vector of 0s.</p>
  
  <p>Here is the export function for getting the matrix into R</p>
  
  <pre><code>REXP x = re.eval("selectionArray &lt;- c()");
  
  for (int j = 0; j &lt; currentSelection.length; j++){
      boolean result = re.assign("currentSNPs", currentSelection[j]);
          if (result == true){
               x = re.eval("selectionArray &lt;- rbind(selectionArray, currentSNPs)");
          }
  }
  </code></pre>
  
  <p>So then I want to execute the the lm() function to get the r squared values</p>
  
  <pre><code>            x = re.eval("fm = lm(selectionArray ~ 0)");
  </code></pre>
  
  <p>I know that I need to use summary(fm) at this point to get the r squared values but I am not sure how to pull them out or what they mean at this point.  I want to know the significance of the deviation from the expected 0 value at each column.</p>
  
  <p>Thanks!</p>