0

Let's use iris

> colnames(iris)
[1] "Sepal.Length" "Sepal.Width"  "Petal.Length" "Petal.Width"  "Species"    

What I want is to select columns by giving the 2 extremities. For example, all columns in between of Sepal.Length and Petal.Width, inclusive of the extremities.

iris %>% dplyr::select(Sepal.Length -- Petal.Width) 

    Sepal.Length Sepal.Width Petal.Length Petal.Width
1            5.1         3.5          1.4         0.2
2            4.9         3.0          1.4         0.2
....


Afiq Johari
  • 1,372
  • 1
  • 15
  • 28

0 Answers0