[R] basics: how do you sort a table?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 17 20:30:22 CEST 2004


On Mon, 17 May 2004, Monica Palaseanu-Lovejoy wrote:

> This may be a very basic question but it seems i cannot figure it 
> out does not matter what.
> 
> how do you sort a table (ascending or descending) after the values 
> in one particular column? I want to do something like the sort 
> function in Xcel.

Well, what is `Xcel' and what is a `table'?  What Excel calls sheets are
usually represented as data frames in R, and ?order will tell you how to
do this.

help.search("sort") would surely have got you there -- did you try it?

> Also, is there any other plot function that accepts log for y axes 
> like the parplot2() from gregmisc? Thanks for the tip Marc about 
> barplot2. very useful indeed!

Look at `log' under ?par.  Almost all basic plot methods do. (It seems an
oversight that barplot does not.) This is in an `Introduction to R', for
example -- have you read that yet?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list