I'm trying to randomly assign some subjects to a set of given data frames (they already have some subjects assigned).
Suppose I have generated
set.seed(5)
no_bin <- sample(c("H1","H2","M1","M2"), 7, replace = TRUE)
vect_groups <- paste0("Group", no_bin)
Then I have a string vector "GroupH2" "GroupM1" "GroupH1" "GroupM1" "GroupM1" "GroupH1" "GroupH1"
and I would like to assign the first row of data frame Subjects to Group H2, the second row of data frame subjects to Group M1...
Can anyone help me?
Aucun commentaire:
Enregistrer un commentaire