Is there a "slice" but for columns?

dplyr

#1

Is there an easy way to select columns by number like how we can do that with dplyr::slice?


#2

Yes, there is

positions <- c(1, 28:31)
DF %>% 
    select(positions)

#3

Damn... I literally use select() 100 times a day and thought -- for some reason -- that I couldn't select by column number. Well... I guess I can! Thanks


#4

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