(c) Vincent : Un data frame...

dd <- data.frame(b = factor(c("Hi", "Med", "Hi", "Low"),
    levels = c("Low", "Med", "Hi"), ordered = TRUE),
    x = c("A", "D", "A", "C"), y = c(8, 3, 9, 9),
    z = c(1, 1, 1, 2))

Réorganiser les colonnes en fonction d'un vecteur c(4,3,2,1)...

ff <- with(dd, dd[,order(c(4,3,2,1))])

Classer les lignes en fonction des valeurs des colonnes...

ee <- with(dd, dd[order(z, x), ])

(c) Dominique : Soit un data frame DF avec les colonnes B C A. Soit un ordre imposé A B C

ordre <- c("A","B","C")
DF_00 <- data.frame(DF[,ordre]) 

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.