Skip to content

Instantly share code, notes, and snippets.

@timriffe
Created March 24, 2025 18:05
Show Gist options
  • Save timriffe/3af54a861cface3fd419689a259726b4 to your computer and use it in GitHub Desktop.
Save timriffe/3af54a861cface3fd419689a259726b4 to your computer and use it in GitHub Desktop.
a second script to get the same statistics from opencite.org (second-order citations)
# See also https://gist.github.com/timriffe/f820143e939f9262b3083122e1ce49ae
# for semantic scholar. Sorry output isn't harmonized
get_citing_papers_opencite <- function(doi){
openciteurl <- paste0( "https://opencitations.net/index/coci/api/v1/citations/",doi )
result <- rjson::fromJSON(file = openciteurl)
result |> lapply(as_tibble) |> bind_rows()
}
get_second_order_citations_opencite <- function(doi){
citing <- get_citing_papers_opencite(doi)
dois <- citing$citing
cites <- sapply(dois, function(doi){
get_citing_papers_opencite(doi) |> nrow()})
citing$second_order_cites <- cites
citing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment