Hi, May be this helps: res1<-as.matrix(transform(expand.grid(k1=0.3*(1:10),k2=1:10),k3=k1*k2))
A.K. Dear all, I'm trying to generate a matrix dataset following 2 loops analysis, such as the follows: for (i in 1:10) { k1 <- 0.3 x i for (j in 1:10) { k2 <- j k3 <- k1*k2 .... }} I would like to generate a dataset with each row containing k1, k2, and corresponding k3. As there's 100 combination of k1 and k2, so there would be 100 rows data. how could I do it? Thanks for the help. York ______________________________________________ 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.