Error :: requires numeric/complex matrix/vector arguments

Published by onesixx on

http://stackoverflow.com/questions/22906804/matrix-expression-causes-error-requires-numeric-complex-matrix-vector-arguments

An Introduction to R : about the difference between a matrix and data.frame.

matrix 곱을 할때, data.frame이라면 matrix로 변환이 필요하다. 

class(A_deviation)
A_covariance <- 1/(n-1) *  t(A_deviation) %*% A_deviation
[1] "data.frame"

Error in t(A_deviation) %*% A_deviation : 
  requires numeric/complex matrix/vector arguments

 

A_covariance <- 1/(n-1) * t(A_deviation) %*% as.matrix(A_deviation)

 

 

Categories: R Basic

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.