Skip to content
Prev 385357 / 398513 Next

select() columns using their positions

Hello,

It is also possible to select by vectors of indices (as opposed to a 
vector):
top_n is just to not clutter the display.


library(dplyr)

data(iris)

iris %>% select(1, 3, 4) %>% top_n(5)
iris %>% select(c(1, 3), 4) %>% top_n(5)


Hope this helps,

Rui Barradas


?s 10:05 de 20/08/20, Ivan Calandra escreveu: