[R] function rep
Erik Iverson
eriki at ccbr.umn.edu
Fri Apr 9 23:10:54 CEST 2010
Hello,
Covelli Paolo wrote:
> Hi,
>
> I've got the following code:
>
> p <- 0.34
> pb <- p*100
> pr <- (1-p)*100
>
> A <- rep(0,pb) # a vector with 34 "zeros"
> B <- rep(1,pr) # a vector with 66 "ones"
Not true. I counted them myself. There are only 65.
I see
> pr == 66
[1] FALSE
> pr < 66
[1] TRUE
So pr must not be what you think it is. For the reason why, see FAQ 7.31.
More information about the R-help
mailing list