Reputation: 47
I was just wondering what could be happening here.
I tried reinstalling the package, but for some reason, wordcountaddin by benmarwick is still producing NA_Real_
in the environment.
Upvotes: 1
Views: 29
Reputation: 73562
You might try stringi::stri_extract
,
md <- system.file(package="plyr", "NEWS.md")
wordcountaddin::text_stats(md)[3] |>
stringi::stri_extract(regex='[0-9]+') |> as.numeric()
# [1] 2748
however, the package (version 0.3.0.9000) has already a builtin word count function.
wordcountaddin::word_count(md)
# [1] 2748
If you still get NA
, there might be an issue with your .Rmd file (e.g. only code, language package not available).
Upvotes: 1