how to sort a dataframe based on one column in r code example Example: r sort data frame by one column population[order(population$age),]