I cannot understand that summation at all,  much less translate it to R. Do you 
have an original citation for this thing? 

As for putting subscripts in parameter lists,  that is not going to happen. You 
have to accept that the code that calls your function needs to do any necessary 
subscripting before it gives that piece to your function. Keep in mind that 
apply functions do this by their nature without the mess of specifying it 
yourself. If you know that the automatic subscripting that sapply does is not 
going to get the result you want then don't use that function. 
-- 
Sent from my phone. Please excuse my brevity.

On November 30, 2015 1:20:34 PM PST, Sherouk Moawad via R-help 
<r-help@r-project.org> wrote:
>Dear R experts 
>Please do you have any idea about how this summation can be written in
>R(the equation can be viewed in the following link): 
>http://s16.postimg.org/or2km30ph/equation.jpg 
>
>I've tried out out this code but it gave me error for writing brackets
>in function of summation:
>
>>>> 
>x=matrix(c(6,2,1),3,1) 
>
>for (l in 1:3){ 
>sum(sapply(1:3, function(j[l]){if(l>1){sum(sapply(1:j[l-1],
>function(j[l]){x[j[l]]*(j[l]<j[l-1])}))}}))}>>>Thank you
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to