[R] summation coding

cberry at tajo.ucsd.edu cberry at tajo.ucsd.edu
Fri Oct 19 17:19:48 CEST 2012


djbanana <karl79264219 at gmail.com> writes:

> Hi,
>
> I think I solved it myself by writing loops.
>
> What I meant is: are there in-built functions in R that calculate the
> following:
>
> a1(b2+...+b190) + a2(b1+b3+...+b190) + ...

Following Rainer's setup:

x <- data.frame( a = sample( 1:10, 4 ), b = sample( 11:20, 4 ) )

isn't 

      prod( colSums(x) ) - x$a %*% x$b

what you are after?

HTH,

Chuck
>  
> I managed to solve it, quite similar to what you just emailed.
>
> Thanks anyway!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/summation-coding-tp4646678p4646712.html
> Sent from the R help mailing list archive at Nabble.com.
>




More information about the R-help mailing list