Imagine data is
v1<-c(1,2,3)
v2<-c(3,1,2)
v3<-c(5,4,3)
v4<-c(2,3,2)
v5<-c(6,2,1)
v6<-c(1,1,2)
v7<-c(2,2,1)
mydata<-data.frame(v1,v2,v3,v4,v5,v6,v7)
I would like every other column from position v3.
v3 v5 v7
1 5 6 2
2 4 2 2
3 3 1 1
I am not sure how to use seq() from a certain position instead of the starting from the first column.
We can use
matchwithseq-matchreturns the position index of the column name that matches the 'v3', then useseqwithbyas 2 andtoas the index of last column (ncol)-output
Or in
dplyrwithnum_range-output