I have a data set that has multiple patterned column names, "tstpos_012720", and "pbpos_012720" basically one for each date. I want to rename them in such a way that I can have each pair ordered together. I am looking for something where I can move the date to the front and add a "t" or "p" to the end. Such that I go from "tstpos_012720, pbpos_012720" to "012720_t, 012720_p"
I am fairly new to R, but I couldn't find anything similar.