How to generate repeated samples in R

r

#1

I am studying about random sampling in R while studying I am able to generate the sample but they all are different I want to repeat some random samples.
for example I am able to generate
sample(1:10,4)
[1] 7 8 9 4
but I want that it should repeat some values between 1 to 10


#2

sample(1:10,4, replace = TRUE)

This should work, default value of replace is FALSE
To check any inbuilt function use ? eg : ‘?sample’