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

knitr::write_bib() gives error for empty string #2240

Closed
3 tasks done
phargarten2 opened this issue Mar 10, 2023 · 2 comments
Closed
3 tasks done

knitr::write_bib() gives error for empty string #2240

phargarten2 opened this issue Mar 10, 2023 · 2 comments

Comments

@phargarten2
Copy link

I like to keep track of the libraries used in a character vector, and at times, an empty string gets added to the character vector of strings that are passed to write_bib().

x <- c("", "haven", "knitr")
knitr::write_bib(x)
# Error in isNamespaceLoaded(pkg) : 
# attempt to use zero-length variable name

Although I can remove it beforehand, I would like knitr::write_bib() to ignore any empty strings passed to it and create references based on the other packages.

Session Info

# xfun::session_info('knitr')

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044), RStudio 2022.12.0.353

Locale:
  LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
  LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

Package version:
  evaluate_0.20   graphics_4.2.2  grDevices_4.2.2 highr_0.10      knitr_1.42      methods_4.2.2   stats_4.2.2    
  tools_4.2.2     utils_4.2.2     xfun_0.37       yaml_2.3.7  

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv cderv closed this as completed in 7e0d4f6 Mar 13, 2023
@cderv
Copy link
Collaborator

cderv commented Mar 13, 2023

Thanks !

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants