in 1:5) {
tsum<- sum(tdat[,j]);
for(k in 1:nrow(tdat)) {
td<- tdat[k,j];
tmp<-tdat[,j];
# sum values <= to current value and divide by the total sum
tdat[k,paste("cpct,j,sep="")]<- sum(tmp[tmp <= td]) / tsum;
}
}
Thanks,
TLowe
--
Vi
Thank you all. That's exactly what I was looking for.
TLowe wrote:
>
> Hey Folks,
>
> Could somebody help me rewrite the following code?
>
> I am looping through all records across 5 fields to calculate the
> cumulative
> percentage of each record (rela
Hey Folks,
Could somebody show me how to loop through a list of dataframes? I want to
be able to generically access their elements and do something with them.
For instance, instead of this:
df1<- data.frame(x=(1:5),y=(1:5));
df2<- data.frame(x=(1:5),y=(1:5));
df3<- data.frame(x=(1:5),y=(1:5));
3 matches
Mail list logo