1
I have a data frame with a lot of information and need to rearrange it in another matrix.
The data frame is of the type:
userID itemID rating
169 242 3
186 302 3
22 377 1
(the matrix has 10,000 items, with the userid varying up to 943 and Itemid varying up to 1682, with a rating of 1-5) what I need to do is assemble a matrix that has 943 rows and 1682 columns, initially filled with only NA, and I need to index the "rating" for each position, respecting the data frame information. In that case, in the matrix, I would need the number that gets in position [169,242]<- 3, and the position [22,377]<- 1
But I can’t assemble for anything a code to do that, I need help!!