Matrix expression causes error “requires numeric/complex matrix/vector arguments”?

后端 未结 4 1933
时光说笑
时光说笑 2020-12-03 09:54
ma=diag(3)+t(da)%*%da

R Code above, error message as follows:

Error in t(da) %*% da : requires numeric/complex matrix/vector argume         


        
4条回答
  •  没有蜡笔的小新
    2020-12-03 10:51

    See also this solution: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16607

    I couldn't figure out what was wrong with combat, so I tried to run PCA (function prcomp) on my dataset. R kept telling me that the input is not a matrix, even though when checking the class of the input object, it did say 'matrix' and mode 'numeric'. After restarting my IDE (Architect in my case), everything was running fine with combat and with PCA.

提交回复
热议问题