In data analysis you can **sort** your data according to a certain variable in the dataset. In R, we can use the help of the function order(). In R, we can easily sort a vector of continuous variable or factor variable. Arranging the data can be of **ascending** or **descending** order.

**Syntax:**

sort(x, decreasing = FALSE, na.last = TRUE):

**Argument:**

**x**: A vector containing continuous or factor variable
**decreasing**: Control for the order of the sort method. By default, decreasing is set to `FALSE`.
**last**: Indicates whether the `NA` 's value should be put last or not