Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default quanteda_options when namespace not loaded #864

Closed
mpadge opened this issue Jul 19, 2017 · 2 comments
Closed

default quanteda_options when namespace not loaded #864

mpadge opened this issue Jul 19, 2017 · 2 comments

Comments

@mpadge
Copy link
Contributor

mpadge commented Jul 19, 2017

Finally enjoying getting to use the package for initial flipper explorations, but discovered that quanteda_options is used throughout, yet is not recognised when the full namespace is not loaded.

pkgs <- tools::CRAN_package_db()
pkg_txt <- apply (cbind (pkgs$Title, pkgs$Description), 1, paste, collapse = " ")
pkg_corpus <- quanteda::corpus (pkg_txt)
pkg_dfm <- quanteda::dfm (pkg_corpus, remove = stopwords ("english"), stem = TRUE,
      remove_punct = TRUE)
## Error in if (verbose) catm("Creating a dfm from a corpus ...\n") :
## argument is of length zero

The quick and dirty solution would be to include an extra

if (is.null (verbose))
   verbose = FALSE

in ... every function.

@kbenoit
Copy link
Collaborator

kbenoit commented Jul 20, 2017

@mpadge great to have you using quanteda and filing issues!

On this options/namespace issue, I'd suspected that this would be the case, and I think the solution will be to insert a call to

quanteda_initialize()

which will initialize at default values any options not already set. @koheiw could do this today or I will tonight or tomorrow.

@kbenoit
Copy link
Collaborator

kbenoit commented Jul 21, 2017

Fixed now in the master branch, but: You will still need to use

pkg_dfm <- quanteda::dfm(pkg_corpus, remove = quanteda::stopwords("english"), stem = TRUE,
                         remove_punct = TRUE)

since stopwords() is a quanteda function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants