Open krbrick opened 4 years ago
I'm trying every which way to identify blank strings in mission statements.
What about something like?
grepl( " {1,}", titles )
Otherwise, my main advice for all of these is to create a few test cases where you know the answer and test your code until you are convinced it works.
> x <- c( "a ", "b ", "c ", "d", "e f g", " h i j" )
> grep( " {1,}$", x, value=T )
[1] "a " "b " "c "
@krbrick what I have done for Q2 is this:
grep( pattern="[[:blank:]]", x=dat$mission, value=TRUE ) %>% head() %>% pander()
grepl("[[:blank:]]",dat$mission)%>% sum()
Hello data people- I'm trying every which way to identify blank strings in mission statements. I've tried
grep("^\\s[^a-z]$", mission) "^\\s[^a-z]+[^0-9]+$" etc. etc. I have also looked at the transformative route: blank.missions <- dat %>% mutate (dat$mission,ch.count = strsplit(mission)) %>% dplyr::n()
also, for Q3, I can clean the missions of spaces with a function, but counting those only at the end using
grepl("\\s$",dat$mission) %>% sum()
doesn't seem right.tips, pointers, self-checks appreciated.