Skip to content

Error when using purrr to map the dfm() function to a list #928

Description

@EricHe98

The map() function in the purrr package throws an error when passed a list to convert to dfms. The error appears whether the input is a list of characters or corpora.

a <- "a"
b <- "b"
c <- list(a, b)
map(c, dfm)

# Error in if (who_called_me_first(sys.calls(), "dfm") == "corpus") { : 
missing value where TRUE/FALSE needed
a <- corpus("a")
b <- corpus("b")
c <- list(a, b)
map(c, dfm)
# Error in if (who_called_me_first(sys.calls(), "dfm") == "corpus") { : 
  missing value where TRUE/FALSE needed

This issue does not occur with other quanteda functions, e.g. corpus().

a <- "a"
b <- "b"
c <- list(a, b)
map(c, corpus)
# [[1]]
# Corpus consisting of 1 document and 0 docvars.

# [[2]]
# Corpus consisting of 1 document 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