For simplicity, here I avoided nested IFs. For the moment, the idea is to set the color only for the Observations belonging to cluster 1.
Doing this, I get the error message "Allocated memory exceeded" on the scatter plot, while SSEtoRserve says "more cluster centers than distinct data points".
My explanation of this is that Qlikview is passing the data to R one record at a time. Therefore, R can't calculate 3 clusters out of a single line of data. This is also confirmed by the fact that if I set the clusters variable to 1, it works.
So, I think that the correct question is: How can I pass my variables to R as a whole? I mean, passing the entire variable array for petLen, petWid, sepLen, sepWid, and not the points one by one.
And also, why is the same function working correctly with the table chart?
Sorry for the length of the post, but I hope this is clear. I am rather new with Qlikview, and I am aware that it is very likely that I am missing some importan and basic detail about the way Qlikview uses data.