I have a vector of data in R that has entries like data = BURR_WK_94_91
and I want to extract the number that falls between the two underscores. So in this case get 94. The strings are of variable length so I can't use a starting position.
I'm almost there with this answer
library(qdap)
genXtract(data, "_", "_")
But that gives me extra data that I don't need. Is there a way to query if the string is a number between the underscores then extract it?