I'm trying to use R's sample function to split a sequence of integers into numerous equal portions for later usage, but even when I specify that I don't want replacement values, I'm still getting repeated digits.
set.seed seq(1,21,1) trials (5)
p1.trials - sample(trials, 7, replace=F) p1.trials - sample(trials, 7, replace=F) p1.trials - sample(trials, 7, replace=F) p
As a result, you'll get the following vector: 5, 14, 18, 6, 2, 12, and 8 are all numbers that can be used to make a number.
trials - tests
[-p1.trials]
sample(trials, 7, replace=F) p2.trials
p2.trials
As a result, you'll get the following vector: 19, 20, 3, 7, 9, 4, 16,
p3.trials - trials[-p2] p3.trials - trials[-p2] p3.trials .trials]
p3.trials
As a result, you'll get the following vector: 1–3, 9, 10–13, 16, 17–19, 20, 21
Can someone explain why (a) I'm receiving repeated values (e.g., "3" appears in both p2.trials and p3.trials) and (b) I'm getting repeated values (e.g., "3" appears in both p2.trials and p3.trials)?