Someone else here in SO helped me before to make this loop:
out <- list(); for (i in c("Abundance..F1..128N..Sample..HSA.gel","Abundance..F1..131N..Sample..HSA.gel", "Abundance..F1..134N..Sample..HSA.gel","Abundance..F1..127C..Sample..Untreated.Control", "Abundance..F1..130C..Sample..Untreated.Control","Abundance..F1..133N..Sample..Untreated.Control", "Abundance..F1..127N..Sample..HSA.gel","Abundance..F1..130N..Sample..HSA.gel", "Abundance..F1..132C..Sample..HSA.gel", "Abundance..F1..126..Sample..Untreated.Control","Abundance..F1..128C..Sample..Untreated.Control", "Abundance..F1..132N..Sample..Untreated.Control")) { out[[i]] <- data[i] / sum(data[i]); }; out <- data.frame(out); View(out)
Thats works perfectly how ever to problem I have now is that I want to use the result from this loop to do more calculations. For instance I need to compute the mean for each "abundance" column however these columns are now the same ones that I used before (as I applied a division on each value, thus the value changed. Now I want to use the output from that loop to do further calculations. Can you help ?
Thanks