title: R says lm.fit wants a matrix
body: <p>I'm learning R in the context of a course, and I'm getting an error message that I don't understand. I load data from a file giving by the instructor to get <code>x</code> and <code>y</code>:</p>
  
  <pre><code>&gt; load("7.R.RData")
  &gt; ls()
  [1] "x" "y"
  </code></pre>
  
  <p>Now I try to fit OLS, but that fails:</p>
  
  <pre><code>&gt; lm.fit(y ~ x)
  Error in lm.fit(y ~ x) : 'x' must be a matrix
  </code></pre>
  
  <p>I'm not really sure what <code>x</code> is. <code>class</code> tells me it's "numeric" and printing its first ten values look like this:</p>
  
  <pre><code>&gt; class(x)
  [1] "numeric"
  &gt; x[1:10]
   [1] 140.1638 140.4303 140.9321 141.7705 140.0042 141.7460 141.8617 141.1520
  </code></pre>
  
  <p>Naively, I tried converting <code>x</code> to a matrix, but that doesn't change anything:</p>
  
  <pre><code>&gt; x = matrix(x)
  &gt; lm.fit(y ~ x)
  Error in lm.fit(y ~ x) : 'x' must be a matrix
  </code></pre>
  
  <p>Googling for this error message didn't turn up anything.</p>