SyntaxFix
Write A Post
Hire A Developer
Questions
Here's the obligatory dplyr answer in case somebody wants to do this with the pipe.
dplyr
test %>% select(sort(names(.)))