I am trying to create a function that will select columns in a DF based on their position. I will always need the first column and then a subset of the DF. I have 1 object for each subset I need to select.
So far I have tried the following:
position <- "1,28:31"
DF %>%
select_(.dots = position)
but I receive the following error:
Error in parse(text = x) : :1:2: unexpected 'x'
It would seem the problem is the comma separation in the column position.
Is there a workaround?
You can just use select
with a numeric vector of indexes:
positions <- c(1,28:31)
DF %>% select(positions)