title | output |
---|---|
patentsview |
github_document |
An R client to the PatentsView API
This is the R package for the new beta version of the patentsview API To get a sense of what's going on with the API, check out the following
- the skips() in the unit tests test/testthat/*.R
- the try/catch block in test/testthat/test-fetch-each-field.R
- comments in data-raw/openAPI_to_csv.pl
You can get the stable version for the original version of the API from CRAN:
install.packages("patentsview")
Or the development version from GitHub:
if (!"devtools" %in% rownames(installed.packages())) {
install.packages("devtools")
}
devtools::install_github("ropensci/patentsview")
Or the R package for the new version of the API from github:
if (!"devtools" %in% rownames(installed.packages())) {
devtools::install_github("ropensci/patentsview@api-redesign")
}
Or the R package for the new version of the API from r-universe:
options(repos = c(
patentsview = "https://mustberuss.r-universe.dev/",
CRAN = "https://cloud.r-project.org"
))
install.packages("patentsview")
The new version of the API requires an api key, or all of your requests will be blocked. An API key can be optained here. The updated R package will look for an environmental variable PATENTSVIEW_API_KEY set to the value of your key. For windows it would be
set PATENTSVIEW_API_KEY=my_keys_value_without quotes
See this page about the change. The navigation there will get you to the updated vignettes and reference pages.
The PatentsView API provides an interface to a disambiguated version of USPTO. The patentsview
R package provides one main function, search_pv()
, to make it easy to interact with the API:
library(patentsview)
search_pv(query = '{"_gte":{"patent_date":"2007-01-01"}}')
#> $data
#> #### A list with a single data frame on patents level:
#>
#> List of 1
#> $ patents:'data.frame': 1000 obs. of 3 variables:
#> ..$ patent_id : chr [1:1000] "10000000" ...
#> ..$ patent_title: chr [1:1000] "Coherent LADAR using intra-pixel quadrature"..
#> ..$ patent_date : chr [1:1000] "2018-06-19" ...
#>
#> $query_results
#> #### Distinct entity counts across all downloadable pages of output:
#>
#> total_hits = 4,642,018
Head over to the package's webpage for more info, including:
- A getting started vignette for first-time users. The package was also introduced in an rOpenSci blog post.
- An in-depth tutorial on writing queries
- A list of basic examples
- Two examples of data applications (e.g., a brief analysis of the top assignees in the field of databases)