• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
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

Related questions

+2 votes
asked Jul 28, 2019 in R Language by Aarav2017
0 votes
asked Nov 6, 2019 in R Language by MBarbieri