Hi,
I'm trying to learn R and get an errand done at the same time. I have a
list of cases with ids numbered sequentially 1 to 403. I want to select
at random exactly 20 without replacement. Here's what I've tried so far:
ids<-(1:403)
pick<-runif(403)
picklist<-as.data.frame(cbind(ids,pick))
who<-subset(picklist, pick<20/403)
who
This works, but I can have anywhere from 16 to 32 cases in the subset
'who', due to random variability in the runif generator. What's a more
efficient (and general) way to extract a subset of exactly n from a total
sample N?