It's easy to see:- > options(digits=22)
- > 40*(1-.8)
- [1] 7.999999999999998223643
复制代码 So, by guess, if the times parameter in rep is not integer. Then the rep(1,40*(1-.8))=rep(1,floor(40*(1-.8)))
In another way:- > rep(1,40*(1-.8))
- [1] 1 1 1 1 1 1 1
- > rep(1,40*(1-.8)+1e-7)
- [1] 1 1 1 1 1 1 1 1
- > rep(1,40*(1-.8)+1e-77)
- [1] 1 1 1 1 1 1 1
复制代码 |