library(tidyverse)
Here is the representation of my dataset:
mydata<-data.frame(NCT_number=c(" 1111"," 2222","0000","3333","4444 ")
I want to spots characters that are preceded or followed by blanks: One space, two spaces and so on. I tried this:
mydata%>%filter(str_detect(NCT_number,c(" " "|" " ")))
My expected result is:
NCT_number
1 1111
2 2222
5 4444
But it didn't works.