5
$\begingroup$

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?

$\endgroup$
1
  • $\begingroup$ 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. 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$
    – EdM
    Commented Jul 23, 2017 at 15:00

1 Answer 1

4
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ considering one is taking one element at a time in sampling. $\endgroup$ Commented Jul 23, 2017 at 6:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.