The arrange function allows you to sort a dataset by one or more variable, either ascending or descending. This function is especially helpful if you plan on aggregating your data with summarize (which, we’ll get to later), so you can select specific rows in that command.
It’s similar to the Excel complex sort, where the order of entry determines which variable is sorted first, second, …, last. For this example, I’ll use data I put together about my reading for 2019 (which you can download here, or use your own datafile of choice). First up, as with all of these posts going forward, we’ll want to load tidyverse. (If you haven’t installed it yet, just add install.packages(“tidyverse”) before the rest of the code.)