'single stage cluster sampling

Choose a single stage cluster sample of size 1,000 students and then calculate the mean value for both variables along with their 95% confidence interval.

Variable 1 is the class number, V2 is the Student number in the class, V3 and V4 is the test results.

c1 <- sample(unique(test$V1), size=1000, replace=F)
c1_s <- test[test$V1 %in% c1,]

I have done the coding for sampling, but I need help with the coding for calculating the mean value for V3 and V4 along with their 95% CI.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source