Function: ordering

This function will sort a dataframe by the column number specified.
First cbind() your variables together and then sort by one column.

ordering=function(dataset, col.num)
{   index=order(dataset[,col.num])
    hold=0
    dataset=dataset[index,]  
    dataset
}

### Example:
# turtles=cbind(w,f,y)
# ordering(turtles, 3)
 

Tags: