Combining two dplyr functions

How to combine select() and arrange() dplyr functions together to select a column first, then arrange that selected column?
I was used the "flights" data set through "nycflights13" package. And I tried to select the "dep_delay" column and same time to arrange it. And at last I tried to extract first 10 rows. I done that task in three steps which mention below,

1). sel <- select(flights, dep_delay)
2). arr <- arrange (sel, dep_delay)
3). view (filter(arr, between(row_number(), 1, 10)))

But I want to combine these three code lines into a single code line.

Is the following acceptable as one code line?

select(flights, dep_delay) %>%  arrange (dep_delay) %>% filter(between(row_number(), 1, 10)) %>% View()
1 Like

It worked.. thanks a lot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.