I need to create 100 independent samples such that each sample has single observation for a customer. There is column c_id which has repeated values. Each sample should have single record of the customer. This is the code which I tried
N_Sample<-100
for (s in 1:N_Sample){
for (i in unique(data$cust_id)){
k=sample(1:length(data$cust_id[data$cust_id==i]),1)
}
}
Is there any other way in which we can create samples for above scenario. Also, there is column "Balance" in my data set. For each sample I need to calculate the 'Total Balance' then average of Total Balance for all 100 samples.