Hi guys,
I've to create a variable a in which elements are column names of a database.
For example, I have the following column names of a df:
colnames(df)
"PS_01", "PS_01_mod2", "PS_02", "PS_02_mod2"
I want to create a vector a in which elements are the column names of df ending with mod2, so I want to create this situation
a <- "PS_01_mod2", "PS_02_mod2"
How can I do this in a simple way?
Or return the value, instead of index: