After reading R's documentation on the function sample
, I still do not understand what does the option replace
do.
data <- sample(x=c(0, 1), size=n, replace=TRUE)
data <- sample(x=c(0, 1), size=n, replace=FALSE)
How to understand this?
Asked
Active
Viewed 2.3k times
2

qazwsx
- 707
- 2
- 7
- 10
-
The underlying statistical issue of the difference between sampling with (`replace = TRUE`) and without replacement (`replace = FALSE`) is covered on this site, for example [here](https://stats.stackexchange.com/q/49480/28500). Please read what's available on this site about this issue and, if you still have questions about this difference in sampling approaches, edit the question to focus on your remaining questions. – EdM Jul 23 '17 at 15:00
1 Answers
3
It's related to sampling techniques. When you sample replace = False, first element/number picked for sampling will not kept back in entire population to be picked again in same sample.
read this article -
https://www.ma.utexas.edu/users/parker/sampling/repl.htm
It's not related to R as such but to- ways of sampling. Also do good research before posting any question. Big guys here will give you -1 for this. :P :P

Arpit Sisodia
- 1,029
- 2
- 7
- 23