Re: [R] write a function inside the summation in a more condensed form

2016-04-11 Thread S Ellison
> I want to write the inside function (3^(x[i]+x[j])) in a more condensed form > cause this will help me when the multiple summations are more than two indices<-c(i,j) #or whatever you want 3^sum( x[indices] ) S Ellison *** This e

[R] write a function inside the summation in a more condensed form

2016-04-08 Thread Mahmoud via R-help
Dear R Experts that's my original equation > x=c(2,4) > Y1=sum(sapply(1:2,function(i){sum(sapply(1:i,function(j){(3^(x[i]+x[j]))}))})) > > y1 [1] 7371 I want to write the inside function (3^(x[i]+x[j])) in a more condensed form cause this will help me when the multiple summations are more t