May 2019
Beginner to intermediate
266 pages
5h 57m
English
The arrange() function is used to sort the columns of a dataset in an ascending or descending order and the default is considered as the ascending order. The working pattern is the same as the ORDER BY clause of SQL.
Our dataset includes details of the model as per the launch year, and now we need to arrange these details according to the year of establishment, which can be achieved as follows:
> mpgArrange<- mpg %>%arrange(mpg$year) > View(mpgArrange)
The reordering pattern according to the year is depicted properly in the following screenshot:

Read now
Unlock full access