I have the following data
data <- data.frame(make=c("af455f5","255tfd4d3","ojt100","12unin234mimo24","sh469dh","6ht6k778k9","kjh457"),
type=c("a","a","a","a","b","a","b"))
I only want to extract any three digit numbers from the "make" elements if the corresponding type is "a".
I've tried using gsub but can only seem to extract all the numbers in a combined string.
the result I'm looking for is as follows
result <- c("455","255","100","234","778")