Answers.Body: <p>From the return value of the <code>class</code> function, it looks like this already is a matrix. It just happens that it is considered by R to be both a matrix <em>and</em> an array.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-13T08:55:15.197Z
Answers.LastActivityDate: 2021-07-13T08:55:15.197Z
Answers.UserDisplayName: gringer
Body: <p>I have a matrix in R. When I run <code>class(my.matrix)</code> it returns:</p>
  <pre><code>&quot;matrix&quot; &quot;array&quot;
  </code></pre>
  <p>Why do I get &quot;array&quot; when in fact I want a plain matrix? The same <code>class</code> output is returned when running <code>as.matrix(my.matrix))</code>.</p>
  <p>Why is that?</p>
  
Tags: <r>
Title: Converting a matrix array to matrix
ThreadText: # Converting a matrix array to matrix
  
  (Asked by: username_0 on 2021-07-12)
  
  I have a matrix in R. When I run `class(my.matrix)` it returns:
  
  ```
  "matrix" "array"
  
  ```
  
  Why do I get "array" when in fact I want a plain matrix? The same `class` output is returned when running `as.matrix(my.matrix))`.
  
  Why is that?
  
  **Tags:** r
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-13. Score: 2
  
  From the return value of the `class` function, it looks like this already is a matrix. It just happens that it is considered by R to be both a matrix *and* an array.
  
  
  ---
  
  