Use the Aids2 dataset(see below). Use a sample size of 50 for each of the following.
Show the sample drawn using simple random sampling with replacement. Show the frequencies (the absolute counts) of female and male patients (sex) and status at end of observation (status) in the sample.
packages prob and sampling may be used
My codes here:
aids <- read.csv(file="D:/Aids2.csv", header=T)
library(sampling)
nrow(aids)
s <- srswor(50, 2843)
rows <- (1:nrow(aids))[s!=0]
rows <- rep(rows, s[s!=0])
female <-rows[aids$sex=="F"]
male <- rows[aids$sex=="M"]
table(female)
table(male)
dead<-rows[aids$status=="D"]
alive<-rows[aids$status=="A"]
table(dead)
table(alive)
So its like I know everything runs fine, but Im not sure how to achieve exactly what the question asking. Can anyone help me to fix my script
links of the file: https://drive.google.com/file/d/1vVKYQ_oDu6Fv00P-vgypifxfMgnyV7qw/view?usp=sharing