[R] lsa-cosine subscript out of bounds error

S Ellison S.Ellison at LGCGroup.com
Fri Oct 28 15:20:17 CEST 2016


> I have created a document term matrix from corpus.I would like to apply
> Cosine similarity to find similar documents,when I apply cosine(w.mt) I get "
> Error in x[,i] : Subscript out of bounds"
> Can anyone let me know how to overcome this error?

Not specifically, from the information you have given.
But in general, subscript errors in a function are often caused by the user (you) supplying the wrong object type or an object with incorrect dimensions. So you could start by making sure w.mt is what cosine() expects. 

class(w.mt)
dim(w.mt)
str(w.mt)

could all help.

S Ellison


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list