[R] :Problem with Looping

Benilton Carvalho bcarvalh at jhsph.edu
Wed Nov 18 00:25:49 CET 2009


it doesn't skip...

think about why:

seq(.30,.5,.01) * 100 - 29 == 1:21

isn't always TRUE.

b

On Nov 17, 2009, at 9:17 PM, Bruno Giovannetti wrote:

> Hello,
>
> Sometimes the looping (using "for") seems to skip some iterations.
>
> An example:
>
> arg <- matrix(NA,length(seq(.30,.5,.01)),1)
> for (i in seq(.30,.5,.01)) {
> arg[i*100-29] <- i
> }
> arg
>
> What is the problem with this coding, please?
>
> Thank you so much,
> --
> Bruno Cara Giovannetti, PhD Candidate
> Economics Department
> Columbia University
> Personal Webpage: www.columbia.edu/~bcg2108
>
> ______________________________________________
> 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.




More information about the R-help mailing list