[R] tempsum
Lars
lars.claussen at pik-potsdam.de
Thu May 12 18:48:32 CEST 2005
hi,
i'd like to calculate a temperatursum, adding the value of each element.
let's say the data looks like this:
x<-c(1,2,3,4,5)
what i want to do, is ploting not the sum in the end but all the
subresults, too,
so my vector holds:
x[i]
[1]
1,3,6,10,15
here is what i tried, which seems to be right to me, bu doesn't work out:
x<-c(1,2,3,4,5)
i<-1
j<-1
z[j]<-x[i]+x[i+1]
p<-z[j]
j<-2:4
i<-3:5
z[j]<-z[j-1]+x[i]
plot (c(p,z[j])
what i get is:
[1] 6.0 12.0 9.2 18.0
any sugestions? lars
More information about the R-help
mailing list