. Advertisement .
..3..
. Advertisement .
..4..
I get the “requires numeric/complex matrix/ vector arguments in R” error as the title says. How can I fix it so the error goes away? Here is my detail:
ma=diag(3)+t(da)%*%da
V45 V46 V47 V48 V49 V50 V51
1 0.461727059 2.357732985 -1.536932071 -1.34425710 0.893541975 -0.0676913075 -0.86532231
2 0.253022555 1.524473647 -0.588911138 -1.65207275 -0.072255170 -0.5212951533 -1.43686625
3 0.824678362 1.497001189 0.335973892 -0.84027799 0.275289411 -0.2921928001 -0.16277595
4 0.854530787 2.258305198 0.107346531 -1.69194014 -0.841572928 -1.1153931009 -1.939461341
5 1.148286984 -0.232390389 -0.498465734 -0.45728816 0.352889082 0.9868844505 -0.68401129
When I operated it, I received the error text:
Error in t(da) %*% da : requires numeric/complex matrix/vector arguments
I appreciate any help from you.
The cause: Because a large number of device learning libraries use matrix multiplication, you can see a similar error if one or more of your inputs are of the class character while the algorithm expects numeric.
Another reason: If you try to pass a data frame where a matrix needs to be.
Solution:
You must convert the
data.frame
to a matrix in order for the matrix multiplication to work:It produces a 7×7 matrix, which you can’t add to the 3×3 identity matrix you’re working with. The code shows something like:
This error can also be triggered if you try to pass a dataframe where a matrix should be.