分组抽样
library(sampling)
sam_group <- strata(dat,stratanames = 'xiangzhen',size = seq(1:20),method = 'srswr')
sam_group <- strata(dat,stratanames = 'xiangzhen',size = rep(3,20),method = 'srswr')
#分组抽样
sam_group <- dat %>%
filter(weihao !='000') %>%
group_by(xiangzhen) %>%
slice(sample(3))
评论
发表评论