Skip to contents

oa_fetch but for a random query

Usage

oa_random(
  entity = oa_entities(),
  output = c("tibble", "dataframe", "list"),
  endpoint = "https://api.openalex.org"
)

Arguments

entity

Character. Scholarly entity of the search. The argument can be one of c("works", "authors", "venues", "institutions", "concepts"). If not provided, `entity` is guessed from `identifier`.

output

Character. Type of output, either a list or a tibble/data.frame.

endpoint

Character. URL of the OpenAlex Endpoint API server. Defaults to endpoint = "https://api.openalex.org".

Value

A data.frame or a list. One row or one element. Result of the random query. If you would like to select more than one random entity, say, 10, use `options = list(sample = 10)` argument in `oa_fetch`.

Examples

oa_random()
#> # A tibble: 1 × 36
#>   id    display_name author ab    publication_date so    so_id host_organization
#>   <chr> <chr>        <list> <chr> <chr>            <lgl> <lgl> <lgl>            
#> 1 http… The Analysi… <df>   This… 2020-01-01       NA    NA    NA               
#> # ℹ 28 more variables: issn_l <lgl>, url <chr>, pdf_url <chr>, license <lgl>,
#> #   version <chr>, first_page <lgl>, last_page <lgl>, volume <lgl>,
#> #   issue <lgl>, is_oa <lgl>, is_oa_anywhere <lgl>, oa_status <chr>,
#> #   oa_url <chr>, any_repository_has_fulltext <lgl>, language <chr>,
#> #   grants <lgl>, cited_by_count <int>, counts_by_year <lgl>,
#> #   publication_year <int>, cited_by_api_url <chr>, ids <list>, doi <chr>,
#> #   type <chr>, referenced_works <lgl>, related_works <list>, …