DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Sorting Simple List In R

01.08.2010
| 3771 views |
  • submit to reddit
        Onliners below create and then sort it in a ascending and descending fashion.

> l <- c(179, 201, 206, 217, 222, 234, 267, 10)//create simple list//

>l[order(l)] //sort ascending//

> l[rev(order(l))] //sort descending.//
    
    Tags:
  • r