lundi 21 janvier 2019

R - Creating a random combination for elemens of two vector

a <- rnorm(10) b <- sample(a,18,replace = T) For each element of "a", I want to randomly assingn a value from vector b. So that ı will have a combination for all elements of vector "a". It will be something like: combinations <- data.table(first=a ,second=sample(b,length(a)))

What ı actually want is a little different than the data.table "combinations" . I want to get a set of combinations where non of the rows has repeated values.




Aucun commentaire:

Enregistrer un commentaire