[R] problem with size of array

From: Manoel Santos <manoelsantos666_at_gmail.com>
Date: Sun, 27 Apr 2008 18:41:44 -0300

+ > p2<-function(r){
+ gama=0
+ for(i in 1:1000){
+ c=caminho[[4]]
+ for(i in 1:caminho[[3]]+1) {
+ c=c+caminho[[i+3]]*((r[i])^(i-1))
+ d=(abs(c))*exp(-(x^2/2))}
+ gama=gama + ( d/(h(r[i])) ) }
+ return(gama)}

> e3<-p2(r)

OBS: r is a rnorm(1000,0,1)

> caminho
  theta_chapeu f_estrela k a0 a1 a2 a3
1 3.2 1.2 3 2 1 4 5 >

i wanted gama to be the sum of all.. but i keep getting gama as a array of 1000 values...
ok r doesn't need u to creat variables and correct themm when needed but why it corrects gama in this case?
like gama[1] them gama[2]... gama[1000]

tks guys u are helping me much

        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
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. Received on Sun 27 Apr 2008 - 21:45:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Apr 2008 - 23:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive