Some 'bibentry' methods have the side effect of changing the default bibstyle.
tools::bibstyle() defines and registers bibtex styles for formatting 'bibentry' objects.
It optionally (and by default) sets a default style. It is also used to get a particular style.
The last feature of bibstyle() is used in 'bibentry' methods defined in packages 'tools' and 'utils' , see the excerpts below.
They have the side effect of resetting the default bibstyle. This seems like a bug. I t can be resolved by adding argument '.default = FALSE' to the calls of bibstyle() in the bibentry methods for sort() and toRd() (there maybe other methods using this and perhaps also unexported functions).
Here is the example from the help page of bibstyle():
c(bibentry(bibtype = "manual",
title = "R: A Language and Environment for Statistical Computing",
author = person("R Core Team"),
organization = "R Foundation for Statistical Computing",
address = "Vienna, Austria",
year = 2013,
url = "https://www.R-project.org"),
bibentry(bibtype = "article",
author = c(person(c("George", "E.", "P."), "Box"),
person(c("David", "R."), "Cox")),
year = 1964,
title = "An Analysis of Transformations",
journal = "Journal of the Royal Statistical Society, Series B",
volume = 26,
pages = "211-252"))