iqss-research / readme-software

Readme2: An R Package for Improved Automated Nonparametric Content Analysis for Social Science
43 stars 10 forks source link

Error in if (dfm_class == "list") { : the condition has length > 1 #6

Closed adafnos closed 1 year ago

adafnos commented 2 years ago

Hi,

After I run:

# Estimate category proportions
readme.estimates <- readme(dfm = wordVec_summaries , labeledIndicator = clinton$TRAININGSET, categoryVec = clinton$TRUTH)

I receive this error:

Error in if (dfm_class == "list") { : the condition has length > 1

Session info:

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

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

other attached packages:
[1] readme_2.0            tensorflow_2.8.0.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3      compiler_4.2.0    tokenizers_0.2.1  prettyunits_1.1.1 base64enc_0.1-3  
 [6] remotes_2.4.2     tools_4.2.0       testthat_3.1.4    pkgbuild_1.3.1    pkgload_1.2.4    
[11] jsonlite_1.8.0    memoise_2.0.1     lifecycle_1.0.1   lattice_0.20-45   png_0.1-7        
[16] rlang_1.0.2       Matrix_1.4-1      cli_3.3.0         fastmap_1.1.0     withr_2.5.0      
[21] rappdirs_0.3.3    desc_1.4.1        fs_1.5.2          devtools_2.4.3    rprojroot_2.0.3  
[26] grid_4.2.0        here_1.0.1        reticulate_1.25   glue_1.6.2        data.table_1.14.2
[31] R6_2.5.1          processx_3.5.3    sessioninfo_1.2.2 callr_3.7.0       purrr_0.3.4      
[36] magrittr_2.0.3    whisker_0.4       SnowballC_0.7.0   ps_1.7.0          tfruns_1.5.0     
[41] ellipsis_0.3.2    usethis_2.1.5     stringi_1.7.6     cachem_1.0.6      crayon_1.5.1     
[46] brio_1.1.3 

Have you seen this before? Thanks for your help.

Best wishes, Andreas

cjerzak commented 2 years ago

Hi Andreas,

I'll look to see what might be happening and how we can fix it. My hunch is that the issue might be due to changes in the new version of some of the package dependencies (in particular, data.table), but we'll confirm this and figure out a fix.

Talk to you soon and thank you for getting in touch with us,

On Thu, May 12, 2022 at 12:17 PM Andreas Dafnos @.***> wrote:

Hi,

After I run:

Estimate category proportions

readme.estimates <- readme(dfm = wordVec_summaries , labeledIndicator = clinton$TRAININGSET, categoryVec = clinton$TRUTH)

I receive this error:

Error in if (dfm_class == "list") { : the condition has length > 1

Session info:

R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 [3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.utf8

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

other attached packages: [1] readme_2.0 tensorflow_2.8.0.9000

loaded via a namespace (and not attached): [1] Rcpp_1.0.8.3 compiler_4.2.0 tokenizers_0.2.1 prettyunits_1.1.1 base64enc_0.1-3 [6] remotes_2.4.2 tools_4.2.0 testthat_3.1.4 pkgbuild_1.3.1 pkgload_1.2.4 [11] jsonlite_1.8.0 memoise_2.0.1 lifecycle_1.0.1 lattice_0.20-45 png_0.1-7 [16] rlang_1.0.2 Matrix_1.4-1 cli_3.3.0 fastmap_1.1.0 withr_2.5.0 [21] rappdirs_0.3.3 desc_1.4.1 fs_1.5.2 devtools_2.4.3 rprojroot_2.0.3 [26] grid_4.2.0 here_1.0.1 reticulate_1.25 glue_1.6.2 data.table_1.14.2 [31] R6_2.5.1 processx_3.5.3 sessioninfo_1.2.2 callr_3.7.0 purrr_0.3.4 [36] magrittr_2.0.3 whisker_0.4 SnowballC_0.7.0 ps_1.7.0 tfruns_1.5.0 [41] ellipsis_0.3.2 usethis_2.1.5 stringi_1.7.6 cachem_1.0.6 crayon_1.5.1 [46] brio_1.1.3

Have you seen this before? Thanks for your help.

Best wishes, Andreas

— Reply to this email directly, view it on GitHub https://github.com/iqss-research/readme-software/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZEOAFOCH7WEMLRIRF37B3VJTLCVANCNFSM5VXXU2XQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

adafnos commented 2 years ago

Thank you Connor!

cjerzak commented 2 years ago

Hi Andreas,

I haven't been able to uncover the cause yet. So, could you run:

save.image("~/Downloads/readme2_text.Rmd")

right before running:

readme.estimates <- readme(dfm = wordVec_summaries , labeledIndicator = clinton$TRAININGSET, categoryVec = clinton$TRUTH)

Then, could you then send along the "readme2_test.Rmd" file as an attachment to this email? That would be extremely helpful in tracking down the issue!

Thank you and have a wonderful weekend!

On Mon, May 16, 2022 at 1:14 PM Andreas Dafnos @.***> wrote:

Thank you Connor!

— Reply to this email directly, view it on GitHub https://github.com/iqss-research/readme-software/issues/6#issuecomment-1127540382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZEOABQBU5Z7TC3NTL3W63VKIU23ANCNFSM5VXXU2XQ . You are receiving this because you commented.Message ID: @.***>

adafnos commented 2 years ago

Hi Connor,

I have attached the file. If you need anything else, please let me know.

Best wishes, Andreas

readme2_test.zip

cjerzak commented 2 years ago

Hi Andreas,

I hope you're doing well! I was looking through the data/code you sent and it looks like you were doing everything exactly right.

My best guess is that there's some issue with how we were checking object classes under the hood; I tweaked the code and pushed it to the github, so if you try re-installing, re-starting R, and trying the code again, we might have luck.

If not, it'd be helpful for us if we could jump on a quick Zoom call this week to see if we can figure it out working together with your PC setup if you have the time, so that we can fix the issue for others in the future.

Thank you and have a great week!

On Mon, Jun 6, 2022 at 3:06 PM Andreas Dafnos @.***> wrote:

Hi Connor,

I have attached the file. If you need anything else, please let me know.

Best wishes, Andreas

readme2_test.zip https://github.com/iqss-research/readme-software/files/8844490/readme2_test.zip

— Reply to this email directly, view it on GitHub https://github.com/iqss-research/readme-software/issues/6#issuecomment-1147426068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZEOAECDPFWJA7SVSDBEJ3VNXZVXANCNFSM5VXXU2XQ . You are receiving this because you commented.Message ID: @.***>

adafnos commented 2 years ago

Hi Connor,

Thanks for your message, I tried to run the code again and here is the result

[1] "Done with this round of training in 0.05 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.05 minutes!"
[1] "Done with this round of training in 0.05 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
[1] "Done with this round of training in 0.06 minutes!"
Error in if (dfm_class == "list") { : the condition has length > 1
In addition: Warning message:
In rm(readme_graph) : object 'readme_graph' not found

Hope this helps, if not we can talk this Friday if you have time.

Thanks again, Andreas

tseidl commented 1 year ago

Has this been resolved?

cjerzak commented 1 year ago

This issue should now be resolved in the latest version. In R, try:

remove.packages("readme")

devtools::install_github("iqss-research/readme-software/readme")

# Restart R session
library(readme)

# run your code