Skip to content

Instantly share code, notes, and snippets.

@dingaroo
Created November 26, 2020 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingaroo/a9481caebb5cf9624d612787bcf3f497 to your computer and use it in GitHub Desktop.
Save dingaroo/a9481caebb5cf9624d612787bcf3f497 to your computer and use it in GitHub Desktop.
Count Occurrence of certain words from a dataframe row in #R
library(stringr)
getCount <- function(data,keyword)
{
wcount <- str_count(dataset$text, keyword)
return(data.frame(data,wcount))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment