Kind of a beginner question here: I have a function, cos.dissim that I'm using to compute the dissimilarity between two vectors and it works fine when I call it by itself with a set value like this:
doc.number = 1
cos.dissim(doc.matrix[doc.number, ], SK$prototype[SK$cluster[doc.number], ])
But when I try to put it in a loop to check all 30 documents, the code does nothing. I don't get an error message of any kind, the code just doesn't output anything.
dissim.tot = function(){
for(x in 1:30){
doc.number = x
cos.dissim(doc.matrix[doc.number, ], SK$prototype[SK$cluster[doc.number], ])
}
}
Am I missing something obvious here? I'm new to the language and Haven't created many for loops.
print(cos.dissim(...)). When you're inside of a loop automatic printing is disabled (which is usually what you want anyway)