This has been dogging me for a while. I've started making a lot of tables
via xtable so the way I want to sort things is not always in alphabetical or
numerical order.

As an example, consider I have a dataframe as follows

set.seed(100)
a <- data.frame(V1=sample(letters[1:4],100, replace=T),V2=1:100)

I know I can sort the columns first by V1 first and then by V2 by:

sorted.a <- a[do.call(order,a[c('V1','V2')]),]

What I want to do is exactly that but I do not want V1 sorted
alphabetically.  Rather, I would like it sorted as 'a','c','d','b'.

I know I could do it with a subset, rbind function but I thought there may
be a more elegant way?

Thanks for the help.

	[[alternative HTML version deleted]]

