The Zotero files to import and convert the data into a bibliographic class | R-Bloggers

The Zotero files to import and convert the data into a bibliographic class | R-Bloggers

2 minutes, 49 seconds Read

[This article was first published on pacha.dev/blog, and kindly contributed to R-bloggers]. (You can report problems here about the content on this page)


Do you want to share your content on R-bloggers? Click here if you have a blog, or here If you don’t.

Due to delays with my stock market payment, if this message is useful for you, I kindly request a minimal donation Buy a coffee for me That will be used to continue my open source efforts. If you need an R package or a shiny dashboard for your team, you can e -mail me or ask me Fiverr. The complete explanation is here: A personal message from an Open Source employee

You can send me questions for the blog using This form.

I received this question from a reader: How to import a Ris or BIB export file from Zotero (Reference Manager) and to convert the data into a bibliographic class. Zotero is open access and their exports cannot be read as easily as a clavariat Bib export file. Some fields are missing, such as ID (key in zotero export) or CI for quotes. Zotero does not extract this information and I don’t need it.

The good news is that I use Zotero daily, and to answer this I will use the subcollection that I made for the Kendall’s correlation coefficient article.

After exporting that sub-collection to Zotero RDF, RIS and BIB, I realized that it is not very easy to read this to R and to export it to a Clarivate Bib file, and I had to make my own functions, but they were a few hundred lines and I organized them as an R package.

The code and data for this example are available on Girub.

Install the Zotero R package with:

remotes::install_github("pachadotdev/zotero")

You can see the code Girub And improve the functions.

Read a zotero exported file such as Sun:

library(zotero)
x = read_zotero("bibliography.bib")
y = read_zotero("bibliography.rdf")
z = read_zotero("bibliography.ris")

The result is the same for each object:

names(z)

[1] "df"  "bib"

z$df

                                                                                                       title
1                                                    Buy Stata | Student single-user purchases (educational)
2                                                        Buy Stata | Student Lab new purchases (educational)
3                                                                 A Deep Dive Into How R Fits a Linear Model
...
                                                                   author year
1                                                              Stata Corp 2025
2                                                              Stata Corp 2025
3                                                           Matthew Drury 2016
...

z$bib

Corp S (2025). “Buy Stata | Student single-user purchases
(educational).” Stata Student single-user purchases,
.

Corp S (2025). “Buy Stata | Student Lab new purchases (educational).”
Educational single-user new purchases,
.

Drury M (2016). “A Deep Dive Into How R Fits a Linear Model.”
.
...

Export the result to a Clistivate Bib file:

write_clarivate(z$bib, "export.bib")
@misc{student-pricing,
  title = {Buy Stata | Student single-user purchases (educational)},
  author = {Corp, Stata},
  year = {2025},
  url = {https://www.stata.com/order/new/edu/profplus/student-pricing/},
  id = {student-pricing},
  citations = {},
  abstract = {Stata Student single-user purchases},
}

@misc{dl,
  title = {Buy Stata | Student Lab new purchases (educational)},
  author = {Corp, Stata},
  year = {2025},
  url = {https://www.stata.com/order/new/edu/lab-licenses/dl/},
  id = {dl},
  citations = {},
  abstract = {Educational single-user new purchases},
}

@misc{lm-in-R_html,
  title = {A Deep Dive Into How R Fits a Linear Model},
  author = {Drury, Matthew},
  year = {2016},
  url = {https://madrury.github.io/jekyll/update/statistics/2016/07/20/lm-in-R.html},
  id = {lm-in-R_html},
  citations = {},
}
...

I hope this is useful 🙂 I have added an optional e -mail field in the form to inform when I answer the questions.


#Zotero #files #import #convert #data #bibliographic #class #RBloggers

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *