0

In binaryratings2 there are 9724 obs of 610 variables and in genre_matrix3 there are 9741 obs of 18 variables. I'm getting error like longer object length is not a multiple of shorter object length. How can I solve this?

#Calculate dot product for User Profiles
result = matrix(0,18,706)
for (c in 1:ncol(binaryratings2)){
 for (i in 1:ncol(genre_matrix3)){
   result[i,c] <- sum((binaryratings2[,c]) * (genre_matrix3[,i]))
  }
}
ClickThisNick
  • 5,110
  • 9
  • 44
  • 69
Ezhil
  • 1
  • 2
  • 7
    Possible duplicate of [longer object length is not a multiple of shorter object length](https://stackoverflow.com/questions/13965099/longer-object-length-is-not-a-multiple-of-shorter-object-length) – AkselA Jan 02 '19 at 11:13
  • We have `9724 != 9741` and `610 != 18`. And I quote [link](https://en.wikipedia.org/wiki/Dot_product) _"In mathematics, the dot product or scalar product[note 1] is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number."_ You can always zero-pad but does it make sense in this context? I have too little information to suggest that. – Duck Dodgers Jan 02 '19 at 11:13

0 Answers0