Hitung kata dalam string r

library(stringr)
str_count(string = "How many words are in this sentence", pattern = '\\w+')
Trustworthy Whale