vendredi 21 décembre 2018

How to order a vector according to a given sequence in R

I'm trying to organize a sequence of data according to a given sequence. For example, the given sequence I have is

set.seed(1)
given_seq <- sample(rep(1:3,2))

The data and its associated sequence

dat_seq <- rep(1:3,2)
dat_value <- rnorm(6)

And I want to organize the data according to the given sequence. That is, 1,2,3 serve as a function of labels of data.

I can see that the organized sequence is not unique, but I'm not sure how to do this.




Aucun commentaire:

Enregistrer un commentaire