Re: [R] sorting matrix output alphabetically

2008-10-18 Thread Greg Snow
Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Bob Green > Sent: Saturday, October 18, 2008 3:59 AM > To: r-help@r-project.org > Subject: [R] sorting matrix output alphabet

Re: [R] sorting matrix output alphabetically

2008-10-18 Thread Prof Brian Ripley
Do you mean sort by the *names* of a *vector* alphabetically? (tot is a vector)? In which case tot[sort.list(names(tot))] If you want to sort new.matrix by its *colnames* of new.matrix, new.matrix[, sort.list(colnames(new.matrix))] See 'An Introduction to R' for the ideas involved, and the help

[R] sorting matrix output alphabetically

2008-10-18 Thread Bob Green
Hello, I have been using the TM package to create a TermDocMatrix, which I have saved as a matrix so that I can view word frequencies. Below is a section of the code that I have used and an excerpt of the output: What I wanted to be able to do is to view the output alphabetically - rather t