I have variable names in the form A_B_C_D
. I would like to extract anything that appears after the second _
. So C
and D
, leaving out the underscore.
Can someone please help me do this?
Thank you.
You can try
unlist(strsplit("A_B_C_D", "_"))[-(1:2)]
[1] "C" "D"