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?
1 Answer
$\begingroup$
$\endgroup$
1
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
-
$\begingroup$ considering one is taking one element at a time in sampling. $\endgroup$ Commented Jul 23, 2017 at 6:41
replace = TRUE
) and without replacement (replace = FALSE
) is covered on this site, for example here. 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. $\endgroup$