Dear Fellows: Thanks you all for your great help. Without your guidance I'd not have been able to get this far. So this is the current problem: I have a series (dataframe with 1 column and 283 rows, all with numbers (no NA's) that go from 0 to 3 or 4 with up to 14 decimals. They indicate a percentage. I have to apply a formula to that dataframe that uses 4 variables I have already stored in a dataframe called combmatrix. df.clases = sapply(seq(1,by=1,length=3921225),function(x) ((AlicuotaBruta/llmcc$Clase)*combmatrix[1,x]+((1/llmcc $Categoria)*AlicuotaBruta)*combmatrix[2,x]+(AlicuotaBruta*llmcc $Phi)*combmatrix[3,x]+ (AlicuotaBruta*llmcc$Rf)*combmatrix[4,x])) The number 3921225 corresponds to the number of dimensions of the combmatrix created with the combd function using 4 elements per dimension oscilating from 0.01 to 100. FIRST PROBLEM: How can I re-proportion the results of each iteration so df.classes sums 100 or 1 before testing the results? SECOND PROBLEM: Since I cannot save df.classes (its too big for my computer), I would need to test and know which value of x hold the correct combination for the desired results and save it phsically in my disk, is that possible with sapply o mapply?. The desired results are so that, among the 283 values resulting from each iteration I need to know how big each element of a certain group of 12 are. In other words, I have selected a test group in the original dataframe and, in order to know if the formula results are better, I need to compare each new group among itself so, for example, if element 1 is bigger than element 2 for more than 40% I will have to discard it, and the same thing happens if element 2 different for less than 20% of the value of element 1. The same rules apply for the rest of the 12 elements, although the boundaries are different. Any ideas on how could I implement this. Sonríe... mañana será peor. Filosofía de Murphy. ------------------------------ Jesús Guillermo Andrade (Abg.) Gerente de Litigios y Corporativo. EDM. AC. API. Andrade & Moreno S.C. (http://amlegal.wordpress.com/) [[alternative HTML version deleted]]