You are a GENIUS !! I don't know how to thank you !! Thank you so much ! I really need to improve my R language (I take any advice) If i can do something for you about MGARCH models, let me know Thx again Bilel
Le Aug 22, 2012 à 8:55 PM, Rui Barradas [via R] a écrit : > Hello, > > I'm being lazy, but the following works. > > r = 3 ; set.seed(1) > v <- matrix(c(rnorm(40)),10,4) > > result <- vector("list", r*ncol(v)) > ires <- 0 > > for (j in 1:4){ > for (i in 1:r){ > x <- t(v[,j]^(i)*v[,1:4]^((r-(4-1)):r)) > #print(x) > ires <- ires + 1 > result[[ ires ]] <- x > } > } > > result <- do.call(rbind, result) > dim(result) > > Lazy because there might be a way of avoiding the loops. If this is just > an example, is your real problem big? > > Hope this helps, > > Rui Barradas > > Em 22-08-2012 14:23, bilelsan escreveu: > > > Dear Ruser, > > Below, the deal (you can copy paste): > > > > r=3 ; set.seed(1) > > v <- matrix(c(rnorm(40)),10,4) > > for (j in 1:4){ > > for (i in 1:r){ > > x <- t(v[,j]^(i)*v[,1:4]^((r-(4-1)):r)) > > print(x) > > } > > } > > > > How to reach to " x " " row bind " inside or outside (preferred) of the > > loop. > > To obtain at the end something like: > >> x > > matrix( , 12*4, 10) > > > > Any help or advice is very welcome > > Many regards > > Bilel > > > > > > > > -- > > View this message in context: > > http://r.789695.n4.nabble.com/rbind-in-a-loop-with-elements-tp4640976.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > [hidden email] 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. > > ______________________________________________ > [hidden email] 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. > > > If you reply to this email, your message will be added to the discussion > below: > http://r.789695.n4.nabble.com/rbind-in-a-loop-with-elements-tp4640976p4641019.html > To unsubscribe from rbind in a loop with " : " elements, click here. > NAML -- View this message in context: http://r.789695.n4.nabble.com/rbind-in-a-loop-with-elements-tp4640976p4641023.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
______________________________________________ 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.