Skip to content

dfm_group() does not group documents when dfm is empty #2225

Description

@koheiw

Describe the bug

require(quanteda)
#> Loading required package: quanteda
#> Package version: 3.2.5
#> Unicode version: 10.0
#> ICU version: 60.2
#> Parallel computing: 32 of 32 threads used.
#> See https://quanteda.io for tutorials and examples.
txt <- c("This is a text. Next test.")
corp <- corpus(txt) %>% 
    corpus_reshape()
toks <- tokens(corp)
dfm_group(dfm(toks))
#> Document-feature matrix of: 1 document, 7 features (0.00% sparse) and 0 docvars.
#>        features
#> docs    this is a text . next test
#>   text1    1  1 1    1 2    1    1
dfm_group(dfm(tokens_remove(toks, "*"))) # wrong
#> Document-feature matrix of: 2 documents, 0 features (0.00% sparse) and 0 docvars.
dfm_group(dfm_remove(dfm(toks), "*")) # wrong
#> Document-feature matrix of: 2 documents, 0 features (0.00% sparse) and 0 docvars.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions