I am trying to create a sparse matrix with my data containing userid, ISBN, and book rating.
here is my data:
User.ID ISBN Book.Rating
[1,] 276726 155061224 5
[2,] 276727 446520802 0
[3,] 276729 521795028 6
[4,] 276733 2080674722 0
[5,] 276736 3257224281 8
[6,] 276737 600570967 6
Here is my code
UIMatrix <- sparseMatrix(i = final.filtered["User.ID"],
j = final.filtered["ISBN"],
x = final.filtered["Book.Rating"])
Error in sparseMatrix(i = final.filtered["User.ID"], j = final.filtered["ISBN"], :
NA's in (i,j) are not allowed
我的数据中没有任何NA仍然会收到此错误。请告诉我如何解决此问题。我的稀疏矩阵包含userid作为行,ISBN作为列,Bookrating作为相应的值。