Re: [R] Can I avoid loops here ?
Thanks Gabor, I will be more specific next time. best - Original Message - From: Gabor Grothendieck [EMAIL PROTECTED] Date: Saturday, September 30, 2006 10:38 pm Subject: Re: [R] Can I avoid loops here ? To: Tong Wang [EMAIL PROTECTED] Cc: R help r-help@stat.math.ethz.ch Try: mapply(%*%, mylist1, mylist2, SIMPLIFY = FALSE) Please provide self-contained examples as requested on the last line of every message to r-help. That means the data for X1, X2, Y1, Y2 should be included so one can run the code you post. On 10/1/06, Tong Wang [EMAIL PROTECTED] wrote: Hi, I have two lists of matrices, and I would like to get a list of term by term product, say, mylist1- list( X1,X2); mylist2-list(Y1,Y2) Need: mylist3-list(X1%*%Y1,X2%*%Y2) Is there a way that allows me to do this without loops ? Thanks a lot. best __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.
[R] Can I avoid loops here ?
Hi, I have two lists of matrices, and I would like to get a list of term by term product, say, mylist1- list( X1,X2); mylist2-list(Y1,Y2) Need: mylist3-list(X1%*%Y1,X2%*%Y2) Is there a way that allows me to do this without loops ? Thanks a lot. best __ R-help@stat.math.ethz.ch 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.
Re: [R] Can I avoid loops here ?
Try: mapply(%*%, mylist1, mylist2, SIMPLIFY = FALSE) Please provide self-contained examples as requested on the last line of every message to r-help. That means the data for X1, X2, Y1, Y2 should be included so one can run the code you post. On 10/1/06, Tong Wang [EMAIL PROTECTED] wrote: Hi, I have two lists of matrices, and I would like to get a list of term by term product, say, mylist1- list( X1,X2); mylist2-list(Y1,Y2) Need: mylist3-list(X1%*%Y1,X2%*%Y2) Is there a way that allows me to do this without loops ? Thanks a lot. best __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.