I have this dataframe with some data that I'm triying to extract, I don't actually have a problem but I feel like there should be a better / more elegant way to do it.
So, I have this string
CVEGEO=0901500011337<BR>CVE_ENT=09<BR>CVE_MUN=015<BR>CVE_LOC=0001<BR>CVE_AGEB=1337<BR>
136 times and I'm interested on MUN=(.*) and AGEB=(.*)
To obtain the info I use:
test1 <- sub(".*_MUN=(.*)<BR>CVE_LOC=0001<BR>CVE_AGEB=(.*)<.*", "\\1_\\2", L1_AGEB$description)
str_split_fixed(test1, "_", 2)
And it works just fine, but, like I said, and this is just for academic/improvement purposes Is there an easier/elegant way?
Thank you