Matrix multiplication in R: requires numeric/complex matrix/vector arguments
<p>I'm using the dataset <code>BreastCancer</code> in the <code>mlbench</code> package, and I am trying to do the following matrix multiplication as a part of logistic regression.</p>

<p>I got the features in the first 10 columns, and create a vector of parameters called theta:</p>

<pre><code>X &lt;- BreastCancer[, 1:10]
theta &lt;- data.frame(rep(1, 10))
</code></pre>

<p>Then I did the following matrix multiplication:</p>

<pre><code>constant &lt;- as.matrix(X) %*% as.vector(theta[, 1])
</code></pre>

<p>However, I got the following error:</p>

<pre><code>Error in as.matrix(X) %*% as.vector(theta[, 1]) : 
  requires numeric/complex matrix/vector arguments
</code></pre>

<p>Do I need to cast the matrix to double using <code>as.numeric(X)</code> first? Values in <code>X</code> look like strings as they have double quotes.</p>