set.seed(42)
df <- data.frame(letters=c(rep('data', 5), rep('oh', 5), rep('yeah', 5), rep('silly', 5)),
numbers=runif(n = 20, min = 1, max = 10))
I know I can sort by letters col alphabetical then numbers col numeric like this:
df[with(df, order(letters, numbers)), ]
thats close, but I want to force letters col to first be sorted by this order c('silly', 'data', 'oh', 'yeah')
how to do this?