Closed yhan818 closed 3 months ago
Thank you for the question @yhan818.
So the main difference is the entity you're querying.
entity = "authors"
, either of these 2 function calls works because you can query directly using the OpenAlex ID via identifier
or using openalex
as a filter for the "authors" entity.library(openalexR)
author_id <- "a5016874418"
author <- oa_fetch(entity = "authors", identifier = author_id, verbose = TRUE)
#> Requesting url: https://api.openalex.org/authors/a5016874418
author <- oa_fetch(entity = "authors", openalex = author_id, verbose = TRUE)
#> Requesting url: https://api.openalex.org/authors?filter=openalex%3Aa5016874418
#> Getting 1 page of results with a total of 1 records...
Created on 2024-03-22 with reprex v2.0.2
entity = "works"
, you need to use authorships.author.id
or author.id
as a filter:library(openalexR)
author_id <- "a5016874418"
oa_fetch(
entity = "works", author.id = author_id,
publication_year = 2023, verbose = TRUE
)
#> Requesting url: https://api.openalex.org/works?filter=author.id%3Aa5016874418%2Cpublication_year%3A2023
#> Getting 1 page of results with a total of 9 records...
#> # A tibble: 9 × 37
#> id display_name author ab publication_date so so_id host_organization
#> <chr> <chr> <list> <chr> <chr> <chr> <chr> <chr>
#> 1 http… The Prevent… <df> "Bac… 2023-01-01 The … http… Elsevier BV
#> 2 http… Lack of eff… <df> "Sev… 2023-04-28 PLOS… http… Public Library o…
#> 3 http… The Impact … <df> "Bac… 2023-06-01 The … http… Elsevier BV
#> 4 http… Comparison … <df> "Bac… 2023-08-14 Clin… http… Lippincott Willi…
#> 5 http… Contemporar… <df> "The… 2023-08-01 Mayo… http… Elsevier BV
#> 6 http… The Indepen… <df> "The… 2023-07-14 Tran… http… Springer Science…
#> 7 http… Large-scale… <df> "In … 2023-08-30 arXi… http… Cornell Universi…
#> 8 http… Large-Scale… <df> "The… 2023-08-31 <NA> <NA> <NA>
#> 9 http… Virologic S… <df> <NA> 2023-09-09 Curr… http… Springer Science…
#> # ℹ 29 more variables: issn_l <chr>, url <chr>, pdf_url <chr>, license <chr>,
#> # version <chr>, first_page <chr>, last_page <chr>, volume <chr>,
#> # issue <chr>, is_oa <lgl>, is_oa_anywhere <lgl>, oa_status <chr>,
#> # oa_url <chr>, any_repository_has_fulltext <lgl>, language <chr>,
#> # grants <list>, cited_by_count <int>, counts_by_year <list>,
#> # publication_year <int>, cited_by_api_url <chr>, ids <list>, doi <chr>,
#> # type <chr>, referenced_works <list>, related_works <list>, …
Created on 2024-03-22 with reprex v2.0.2
Hi,
I have the following code:
author_name <- "Bekir Tanriover" author_id <- "a5016874418"
1. working
author<- oa_fetch(entity = "authors", identifier = author_id, verbose = TRUE)
2. Not working "author.id" is not a valid field
author<- oa_fetch(entity = "authors", author.id = author_id, verbose = TRUE)
3. Not working with para "identifier". It works with para "author.id"
work <- oa_fetch(entity = "works",
author.id = author_id,
For documentation at https://docs.ropensci.org/openalexR/reference/oa_fetch.html the parameter of the above shall be "identifier", but the code works one way or another.
Why is that?