Dictionary function error

Hello.

I have the following error in RStudio

sms_dict <- Dictionary(findFreqTerms(sms_dtm_train, 5))
Error in Dictionary(findFreqTerms(sms_dtm_train, 5)) : "Dictionary" function could not be found

Please help me.

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers. Screenshots are seldom helpful.

Fortunately , the error message gives enough to go on

"Dictionary" function could not be found

says it simply.

Dictionary is being used as a function

sms_dict <- Dictionary(findFreqTerms(sms_dtm_train, 5))

Some functions are always available, like

ls()

Some are available only when they are defined by the user

require(clipr)
#> Loading required package: clipr
#> Welcome to clipr. See ?write_clip for advisories on writing to the clipboard in R.
require(magrittr)
#> Loading required package: magrittr
require(stringr)
#> Loading required package: stringr

specimen <- function(x)
  deparse(x) %>%
  str_c(collapse = '') %>%
  str_replace_all('\\s+', ' ') %>%
  str_replace_all('\\s*([^,\\()]+ =) (c\\()', '\n  \\1\n    \\2')  %>%
  str_replace_all('(,) (class =)', '\\1\n  \\2') %>%
  write_clip(allow_non_interactive = TRUE)

Functions are case sensitive. In the example above, specimen works, but Specimen will not.

Most functions come from optional libraries. Those first have to be installed

install.packages("dplyr") # only has to be done once

the

library("dplyr")

will make all the many functions in that library immediately available.

If you don't know which package that the function comes from, it' often easy to find them using rseek site that searches Google with special syntax to bring R resources to the top.

That is easy with unusual names, such as GetBatchSymbols, but it is not easy finding the right Dictionary

Thanks technocrat.

I'm a beginner using R, sorry.

I am trying to learn R to do my master thesis which is about a predictive maintenance model.

1 Like

No sorries here. Everyone in the community has been through the learning curve!

Hi. It seems tm::Dictionary was deprecated. See this link for more details and a possible solution: https://stackoverflow.com/questions/47141436/issue-with-dictionary-function-in-r

1 Like

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