Count word occurrences in R

前端 未结 4 1248
误落风尘
误落风尘 2020-11-29 06:04

Is there a function for counting the number of times a particular keyword is contained in a dataset?

For example, if dataset <- c(\"corn\", \"cornmeal\", \"

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 06:27

    You can also do something like the following:

    length(dataset[which(dataset=="corn")])
    

提交回复
热议问题