I want to make 2 random groups (of 6 participants each) for an experiment based on my variable x (continuous between -3.5 and 3.5). The groups should be formed in a way that after formation a t-test to compare groups will be non-significant (e.g. group 1 has mean x of 2.05 and group 2 of 2.15). Hence, I would also like an additional column to the dataset which basically says for each participant either group1 or group2 and keep all other columns.
So far I've played around with the package dplyr but haven't found a solution. Here is a reproducible sample:
ID <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14")
x <- c("0.65","1.25","1.55","1.80","1.95","2.05","2.25","2.30","2.45","2.6","2.85","2.9","3.00","3.05") age <- c("36","26","87","27","24","50","27","36","46","44","33","38","47","41")
gender <- c("M","M","F","M","F","F","M","F","M","F","F","M","F","F")
df <- data.frame(ID, x, age, gender)
Aucun commentaire:
Enregistrer un commentaire