Is there a way to get the date out of these strings? I only want to isolate the year (e.g., 2019, 2020, 2021)
Ex: USP_03182019_H13
A tidyr-friendly answer would be ideal.
date <- c("USP_03182019_H13","DED_03212019_H1","EL_03202019_H8","EL_10082020_H6","DSP_05122021_H5")
# date
#1 USP_03182019_H13
#2 DED_03212019_H1
#3 EL_03202019_H8
#4 EL_10082020_H6
#5 DSP_05122021_H5