R
API
Published

July 13, 2024

DOI reference with httr2

Get citation references from DOI API with httr2.

library(tidyverse)
library(httr2)

get_doi_reference <- function(doi) {
  request(paste0("https://doi.org/", doi)) |>
    req_headers("Accept" = "text/x-bibliography") |>
    req_perform() |>
    resp_body_string()
}

references <-
  tibble(
    doi = c(
      "10.1177/1465116507076430",
      "10.1080/01402382.2013.783347",
      "10.1177/0958928715573481",
      "10.1017/pan.2021.28"
    )
  ) |>
  mutate(reference = map_chr(doi, get_doi_reference))

references
doi reference
10.1177/1465116507076430 Döring, H. (2007). The Composition of the College of Commissioners. European Union Politics, 8(2), 207–228. https://doi.org/10.1177/1465116507076430
10.1080/01402382.2013.783347 Döring, H., & Hellström, J. (2013). Who Gets into Government? Coalition Formation in European Democracies. West European Politics, 36(4), 683–703. https://doi.org/10.1080/01402382.2013.783347
10.1177/0958928715573481 Döring, H., & Schwander, H. (2015). Revisiting the left cabinet share: How to measure the partisan profile of governments in welfare state research. Journal of European Social Policy, 25(2), 175–193. https://doi.org/10.1177/0958928715573481
10.1017/pan.2021.28 Herrmann, M., & Döring, H. (2021). Party Positions from Wikipedia Classifications of Party Ideology. Political Analysis, 31(1), 22–41. https://doi.org/10.1017/pan.2021.28