im having some trouble figuring out how to do this.
I want to sort a dataframe by a column containing factors that are the same as the factors I have in a list. It is important that the code doesn't change the order of the rows in each factor though.
Ideas?
edit:
salmon <- c("red", 3,7, 5)
bass <- c("red", 1,3,5)
shrimp <- c("blue", 1, 4, 2)
carp <- c("orange", 6, 6, 6)
dfex <- data.frame(salmon, bass, shrimp, carp)
dfex <- data.frame(t(dfex))
ordering <- c("blue", "orange", "red")
so the idea here is to reorder the dataframe by using the ordering vector