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

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x