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.