# NOT RUN {
#defines the prescribed inclusion probabilities
pik=c(0.2,0.7,0.8,0.5,0.4,0.4)
#selects a sample
s=UPmultinomial(pik)
#the selected units are
(1:length(pik))[s!=0]
#with the number of replicates
s[s!=0]
#or use
rep((1:length(pik))[s!=0],s[s!=0])
# }
Run the code above in your browser using DataLab