in R Language by
arrange() in R language

▼ Show 1 Answer

0 votes

The library dplyr has its sorting function. It works like a charm with the pipeline. The arrange() verb can reorder one or many rows, either ascending (default) or descending.

- `arrange(A)`: Ascending sort of variable A
- `arrange(A, B)`: Ascending sort of variable A and B
- `arrange(desc(A), B)`: Descending sort of variable A and ascending sort of B		

We can sort the distance by destination.

# Sort by destination and distance
step_2_df <-step_1_df %>%
	arrange(GoingTo, Distance)
Learn More with Madanswer

Related questions

0 votes
asked Nov 14, 2019 in R Language by MBarbieri