Reputation: 49
I have a large data frame with 341 variables. Some of them same type of data for different times. For example for viral load at initiation "t0vload", viral load at 6 moths "t6vload" and goes on. How can I write a command to subset all the columns with a name consisting "-vload"?
Upvotes: 1
Views: 73
Reputation: 7433
For the record, using dplyr
, the following should work as well:
select(dat, ends_with("vload"))
or:
dat %>% select(ends_with("vload"))
Upvotes: 1