I'm still unsure of what you are attempting to do with this data. First, it is very sparse, appearing to be the counts of occurrences of 2567 strings, some of which are recognizable English words. I suspect that you are trying to get something very simple like the frequency of these strings within whatever corpus they inhabit. The code you sent does some manipulations I can understand, others seem to be redundant or even discarded after they are performed. For instance, you write the result file twice, line by line. You also try to access the element "matrixdata$ID" when as far as I can see, it doesn't exist. That would certainly stop the script. Without knowing what is supposed to be the result of this, it is impossible to even analyze code that runs (for quite a few minutes) and does not appear to produce any output.. Jim