I am trying to accomplish the following:
I have a dataset with many variables and among them one called Gender, so with 2 levels "M" and "F".
I want to sample without replacement this dataset, in let's say 1000 observations so I get equal number of "M" and "F", that is 500 each.
Bellow is the code I am trying. x is the dataset so x$gender
is the variable column
test_sample<- x[sample(nrow(x),1000,replace = FALSE,prob = ?) ,]
Any idea how can I make this work ?