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

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

Closed
EricHe98 opened this issue Aug 18, 2017 · 1 comment
Closed

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

EricHe98 opened this issue Aug 18, 2017 · 1 comment

Comments

@EricHe98
Copy link

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.
@EricHe98
Copy link
Author

Oh, and here is the session info.

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reshape2_1.4.2  bindrcpp_0.2    readtext_0.50   stringr_1.2.0   purrr_0.2.3     dplyr_0.7.2     quanteda_0.99   devtools_1.13.3

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12        git2r_0.19.0        plyr_1.8.4          bindr_0.1           tools_3.3.3         digest_0.6.12      
 [7] lubridate_1.6.0     memoise_1.1.0       tibble_1.3.3        gtable_0.2.0        lattice_0.20-34     pkgconfig_2.0.1    
[13] rlang_0.1.2         Matrix_1.2-8        fastmatch_1.1-0     curl_2.8.1          withr_2.0.0         httr_1.3.0         
[19] knitr_1.17          grid_3.3.3          glue_1.1.1          data.table_1.10.4   R6_2.2.2            ggplot2_2.2.1      
[25] magrittr_1.5        scales_0.4.1        assertthat_0.2.0    colorspace_1.3-2    stringi_1.1.5       RcppParallel_4.3.20
[31] lazyeval_0.2.0      munsell_0.4.3      

kbenoit added a commit that referenced this issue Aug 21, 2017
- decrease reliance on who_called_me_first()
- solve #928 purrr::map() problem
- consolidates print messaging in dfm() generic
- adds tests for `dfm()` messages with `verbose = TRUE`
kbenoit added a commit that referenced this issue Aug 21, 2017
@kbenoit kbenoit mentioned this issue Aug 21, 2017
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

1 participant