Re: [R] product of successive rows

From: Moshe Olshansky <m_olshansky_at_yahoo.com>
Date: Tue, 29 Jul 2008 00:51:08 -0700 (PDT)


Assuming that the number of rows is even and that your matrix is A, element-wise product of pairs of rows can be calculated as

A[seq(1,nrow(A),by=2),]*A{seq(2,nrow(A),by=2),]

> From: rcoder <mpdotbook_at_gmail.com>
> Subject: [R] product of successive rows
> To: r-help@r-project.org
> Received: Monday, 28 July, 2008, 8:20 AM
> Hi everyone,
>
> I want to perform an operation on a matrx that outputs the
> product of
> successive pairs of rows. For example: calculating the
> product between rows
> 1 & 2; 3 & 4; 5 & 6...etc.
>
> Does anyone know of any readily available functions that
> can do this?
>
> Thanks,
>
> rcoder
>
>
> --
> View this message in context:
> http://www.nabble.com/product-of-successive-rows-tp18681259p18681259.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Tue 29 Jul 2008 - 07:53:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 08:32:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive