[R] more on vectoring a simple for

Cezar Augusto de Freitas Anselmo cafa at ime.unicamp.br
Mon Nov 25 23:34:22 CET 2002


Excuse me, but I wasn't clear. It's a generic funcion, like
f(beta) and g(beta)

result<-rep(0,3)
for(i in 1:3) result[i]<-sum(f(beta[-i])/g(beta[-i]))

for example, f(beta)=log(abs(beta)) and g(beta)=beta^2:
for(i in 1:3) result[i]<-sum(log(abs(beta[-i]))/(beta[-i]^2))

How can I write this with no for?

Thanks and excuses by the lost time.
========================================
Cezar Freitas (ICQ 109128967)
IMECC - UNICAMP
Campinas, SP - Brasil



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list