[R] for loop problem

Tobias Verbeke tobias_verbeke at skynet.be
Mon Jul 14 13:18:26 CEST 2003

Sir Dalgaard,

Thank you for your kind reply.
> > In what way am I ill-treating R ?
> You're ill-treating the readers by not 
> giving a full example of a
> call to the function... 

ax.to.nax.for(qx, ax)

> However: in the for loop, i will be one of
> 0,1,5,10 and n is the vector c(1,4,5,5) 
> so n[i+1] is indexing out of
> bounds and e.g. 
> > n[6]
> [1] NA
> and the : operator subsequently objects. 
> Did you mean (i+1):(i+n[j]+1) or so? 

Yes! I meant (i+1):(i+n[j])

Thanks again,


More information about the R-help mailing list