Counting number of UPPERCASE words

Dear Community,

Is there a way to count the uppercase words in a dataset? So far, I can only count the number of uppercase characters but not words. Can someone shed some light on this?

library(stringr)

uppers <- "\\b[:upper:]+\\b"

text <- "Is there a way to count the UPPERCASE words in a dataset? So far, I can only count the number of UPPERCASE characters but not words. Can someone shed some light on this?"

str_count(text,uppers)
#> [1] 3

works fine.... Thanksss

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.