type sex eth a_t a_tm b_tm c_tm d_tm e_tm
1 m a 0 0 0 1 1 0
0 f b 1 1 0 0 1 1
0 m a 0 0 0 1 1 1
1 f a 1 1 1 1 0 0
0 f c 1 0 0 1 0 1
How can I select columns using dplyr where the column ends with _tm or the column is in a list containing sex or eth?
expected output
sex eth a_tm b_tm c_tm d_tm e_tm
m a 0 0 1 1 0
f b 1 0 0 1 1
m a 0 0 1 1 1
f a 1 1 1 0 0
f c 0 0 1 0 1
I want to do this in dplyr without using grepl... is this possible?