Welcome to the community!
If this is the only constraint, then you can do something like this:
- Suppose
x is the vector of elements of length n.
- Suppose you need a sample of size
m from this population, where each element must occur at least r times.
- Generate a WR sample of size
m - (n * r) from this population, say z.
- Construct
y by concatenating z with r copies of x.
- A permutation of
y should give you the desired result.
The R functions that you need for this are rep and sample.
Hope this helps.