However my goal is to make a classification as in this image. So a classification where the tache 1 2 3 3 4 would be consecutive for the same variable in the same Sujet.
I hope I've made myself clear,
have a good day
I don't see anything wrong with the output from your screenshots.
You said that you've used Subject, variable and Task to order them. I can't find task in the screenshot, but the others are correctly ordered. Same for the dplyr approach.
Remember that ordering happens sequentially. Initially, the 1st vector is sorted. Then, to break the ties, the 2nd vector is used, then the 3rd and so on. If you want to give importance to Tache, consider using it as the 1st vector, like complete<-complete[order(complete$Tache, complete$variable),].
If it doesn't solve your problem, please provide a REPRoducible EXample of your problem. It provides more specifics of your problem, and it helps others to understand what problem you are facing.
If you don't know how to do it, take a look at this thread: