crsh / citr

RStudio Addin to Insert Markdown Citations
Other
407 stars 46 forks source link

Exporting bib file can successfully be useful and insert citation is ok, but once clicking "Connect and load libraries", it crashed. #93

Open qq1307229333 opened 1 year ago

qq1307229333 commented 1 year ago

I think I conducted the correct procedures according to methods. Firstly, I exported .bib file named "references.bib" at my folder D:/tests/. Then, In Rstudio, I clicked Addins -> insert citations one by one.

image

And here displayed ok, I think. image

Here displayed good in Rstudio and word, too. image

However, I started to click Connect and load libraries because I want to use the function of syncing Zotero items (I even don't want to exported .bib file, firstly). As you can see the words:"If you are using Zotero citr can access your reference database directly." image

But the result is error and throw up the messages. image

> citr:::insert_citation()

Listening on http://127.0.0.1:6934
Warning: The select input "selected_key" contains a large number of options; consider using server-side selectize for massively improved performance. See the Details section of the ?selectizeInput help topic.
Warning: Error in data.frame: arguments imply differing number of rows: 0, 1
  73: stop
  72: data.frame
  71: bibtex::do_read_bib
  70: RefManageR::ReadBib
  69: import_bbt
  68: load_betterbiblatex_bib
  64: <reactive>
  48: bibliography
  47: observe
  46: <observer>
   3: shiny::runApp
   2: runGadget
   1: citr:::insert_citation
Warning: Error in data.frame: arguments imply differing number of rows: 0, 1

It's so weird. Hope you can help me solve it, thank you.

Here is my info:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

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

other attached packages:
[1] shiny_1.7.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3      plyr_1.8.7        citr_0.3.2       
 [4] compiler_4.0.3    bslib_0.4.2       later_1.3.0      
 [7] jquerylib_0.1.4   shinyjs_2.1.0     tools_4.0.3      
[10] digest_0.6.29     timechange_0.1.1  jsonlite_1.8.0   
[13] lubridate_1.9.0   evaluate_0.14     memoise_2.0.1    
[16] lifecycle_1.0.3   rlang_1.0.6       bibtex_0.5.0     
[19] cli_3.5.0         rstudioapi_0.14   curl_4.3.2       
[22] yaml_2.3.5        xfun_0.30         fastmap_1.1.0    
[25] xml2_1.3.3        stringr_1.5.0     RefManageR_1.4.0 
[28] httr_1.4.4        knitr_1.36        generics_0.1.3   
[31] sass_0.4.1        glue_1.6.2        fontawesome_0.4.0
[34] R6_2.5.1          rmarkdown_2.11    magrittr_2.0.1   
[37] backports_1.4.1   promises_1.2.0.1  ellipsis_0.3.2   
[40] htmltools_0.5.4   assertthat_0.2.1  mime_0.12        
[43] xtable_1.8-4      httpuv_1.6.5      stringi_1.7.6    
[46] miniUI_0.1.1.1    cachem_1.0.6      crayon_1.5.2

What I had done are:

  1. update Rstudio and packages related to citr.
  2. Better BibTex installed.
  3. YAML code:
    
    ---
    title: "test"
    author: "YunFei"
    date: "2022-12-29"
    bibliography: ["references.bib"]
    output: word_document
    ---
stainesa commented 1 year ago

Can confirm this crash - is there a limit on the size of zotero libraries which can be read in this way?

stainesa commented 1 year ago

So, I found I had three Group libraries with no records. load_betterbiblatex_bib crashed on the first of these, so I removed that one Then it crashed on the second so I removed the other two, so that every group library in my Zotero had records in it. load_betterbiblatex_bib then worked, generating a large BibEntry object ( list of lists)..

Suggest you have a look and see if you have empty libraries?

I then tried the citr Shiny window, and I note that there is a settings button, which allows one to choose the Zotero libraries to be installed. In practice there seems to be no way to pull out a single Zotero collection.

This now works, but I note that it switches off after entering one reference. This won't work too well for large Zotero libraries, which can take a minute or two to load.

stainesa commented 1 year ago

suggest you investigate rbbt - may work better for the moment for both our use cases?

Damien-Dufour commented 1 year ago

I had the same problem, it seems to have been solved by removing "abstract" and "notes" from the exported fields in zotero as described in the known problem section of the readme.

It goes in the direction of the library being too big to import