Pretty simple question. I am trying to sample 20 numbers (with replacement) from the first 10 natural numbers.
This
sample(x = 1:10, size = 0.2*100, replace = TRUE) %>% length
gives 20
(and works), but
sample(x = 1:10, size = (1-0.8)*100, replace = TRUE) %>% length
gives 19
.
I can always do
sample(x = 1:10, size = (100 - 0.8*100), replace = TRUE) %>% length
(that works fine and shows 20
), but I'm curious why having it in parenthesis doesn't work.