On Oct 30, 2009, at 11:46 AM, Robert Wilkins wrote:
How do you do a double loop through a matrix or data frame , and within each iteration , do a calculation and append it to a new, second data frame? (So, if your original matrix or data frame is 4 x 5 , then 20 calculations are done, and the new data frame, which had 0 rows to start with, now has 20 rows)
Much vagueness in question, Grasshopper: mtx <- matrix(1:20, 4) df1 <- data.frame(x=1:20) df1$mtxsq <- as.vector(mtx)^2 df1 -- David Winsemius, MD Heritage Laboratories West Hartford, CT ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.