I have a bunch of colnames
L_1_3
L_2_23
L_3_91
L_3_16
I want to replace these colnames with new names using the last digits following the _ like this:
3
23
91
16
I've tried colnames(X) <- gsub("L_\\d\\d_", "", colnames(X)) which works for strings with double digits at the end. I want one that works for both single and double digits.
Thank you!