in R Language by

R Sort a Data Frame using Order()

1 Answer

0 votes

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.


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


  • 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