This function makes an HTTP request to the PatentsView API for data matching the user's query.
search_pv(query, fields = NULL, endpoint = "patents", subent_cnts = FALSE, mtchd_subent_only = TRUE, page = 1, per_page = 25, all_pages = FALSE, sort = NULL, method = "GET", error_browser = getOption("pv_browser"), ...)
query | The query that the API will use to filter records.
|
---|---|
fields | A character vector of the fields that you want returned to you.
A value of |
endpoint | The web service resource you wish to search. |
subent_cnts | Do you want the total counts of unique subentities to be
returned? This is equivalent to the |
mtchd_subent_only | Do you want only the subentities that match your
query to be returned? A value of |
page | The page number of the results that should be returned. |
per_page | The number of records that should be returned per page. This
value can be as high as 10,000 (e.g., |
all_pages | Do you want to download all possible pages of output? If
|
sort | A named character vector where the name indicates the field to
sort by and the value indicates the direction of sorting (direction should
be either "asc" or "desc"). For example, |
method | The HTTP method that you want to use to send the request. Possible values include "GET" or "POST". Use the POST method when your query is very long (say, over 2,000 characters in length). |
error_browser | The program used to view the HTML error messages sent by the API. This should be one of the following:
|
... |
A list with the following three elements:
A list with one element - a named data frame containing the data returned by the server. Each row in the data frame corresponds to a single value for the primary entity. For example, if you search the assignees endpoint, then the data frame will be on the assignee-level, where each row corresponds to a single assignee. Fields that are not on the assignee-level would be returned in list columns.
Entity counts across all pages of output (not just
the page returned to you). If you set subent_cnts = TRUE
, you will
be returned both the counts of the primary entities and the subentities.
Details of the HTTP request that was sent to the server.
When you set all_pages = TRUE
, you will only get a sample request.
In other words, you will not be given multiple requests for the multiple
calls that were made to the server (one for each page of results).
search_pv(query = '{"_gt":{"patent_year":2010}}')#> $data #> #### A list with a single data frame on a patent level: #> #> List of 1 #> $ patents:'data.frame': 25 obs. of 3 variables: #> ..$ patent_id : chr [1:25] "7861317" ... #> ..$ patent_number: chr [1:25] "7861317" ... #> ..$ patent_title : chr [1:25] "Nose cover" ... #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_patent_count = 100,000search_pv( query = qry_funs$gt(patent_year = 2010), fields = get_fields("patents", c("patents", "assignees")) )#> $data #> #### A list with a single data frame (with list column(s) inside) on a patent level: #> #> List of 1 #> $ patents:'data.frame': 25 obs. of 31 variables: #> ..$ patent_abstract : chr [1:25] "A nose cover or nos".. #> ..$ patent_average_processing_time : logi [1:25] NA ... #> ..$ patent_date : chr [1:25] "2011-01-04" ... #> ..$ patent_firstnamed_assignee_city : chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_country : chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_id : chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_latitude : chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_location_id: chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_longitude : chr [1:25] NA ... #> ..$ patent_firstnamed_assignee_state : chr [1:25] NA ... #> ..$ patent_firstnamed_inventor_city : chr [1:25] "San Pedro" ... #> ..$ patent_firstnamed_inventor_country : chr [1:25] "US" ... #> ..$ patent_firstnamed_inventor_id : chr [1:25] "7861317-1" ... #> ..$ patent_firstnamed_inventor_latitude : chr [1:25] "33.7358" ... #> ..$ patent_firstnamed_inventor_location_id: chr [1:25] "33.7358333|-118.291".. #> ..$ patent_firstnamed_inventor_longitude : chr [1:25] "-118.291" ... #> ..$ patent_firstnamed_inventor_state : chr [1:25] "CA" ... #> ..$ patent_id : chr [1:25] "7861317" ... #> ..$ patent_kind : chr [1:25] "B2" ... #> ..$ patent_number : chr [1:25] "7861317" ... #> ..$ patent_num_cited_by_us_patents : chr [1:25] "3" ... #> ..$ patent_num_claims : chr [1:25] "9" ... #> ..$ patent_num_combined_citations : chr [1:25] "12" ... #> ..$ patent_num_foreign_citations : chr [1:25] "0" ... #> ..$ patent_num_us_application_citations : chr [1:25] "0" ... #> ..$ patent_num_us_patent_citations : chr [1:25] "12" ... #> ..$ patent_processing_time : chr [1:25] "2279" ... #> ..$ patent_title : chr [1:25] "Nose cover" ... #> ..$ patent_type : chr [1:25] "utility" ... #> ..$ patent_year : chr [1:25] "2011" ... #> ..$ assignees :List of 25 #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_patent_count = 100,000search_pv( query = qry_funs$gt(patent_year = 2010), method = "POST", fields = "patent_number", sort = c("patent_number" = "asc") )#> $data #> #### A list with a single data frame on a patent level: #> #> List of 1 #> $ patents:'data.frame': 25 obs. of 1 variable: #> ..$ patent_number: chr [1:25] "7861317" ... #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_patent_count = 100,000search_pv( query = qry_funs$eq(inventor_last_name = "crew"), all_pages = TRUE )#> $data #> #### A list with a single data frame on a patent level: #> #> List of 1 #> $ patents:'data.frame': 98 obs. of 3 variables: #> ..$ patent_id : chr [1:98] "3961846" ... #> ..$ patent_number: chr [1:98] "3961846" ... #> ..$ patent_title : chr [1:98] "Ultra-high reduction microfiche layout and p".. #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_patent_count = 98search_pv( query = qry_funs$contains(inventor_last_name = "smith"), endpoint = "assignees" )#> $data #> #### A list with a single data frame on an assignee level: #> #> List of 1 #> $ assignees:'data.frame': 25 obs. of 4 variables: #> ..$ assignee_id : chr [1:25] "000fd451e3903862279995c8f7946893" ... #> ..$ assignee_first_name : chr [1:25] NA ... #> ..$ assignee_last_name : chr [1:25] NA ... #> ..$ assignee_organization: chr [1:25] "Ferranti-Packard Limited" ... #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_assignee_count = 8,943#> $data #> #### A list with a single data frame on a patent level: #> #> List of 1 #> $ patents:'data.frame': 25 obs. of 3 variables: #> ..$ patent_id : chr [1:25] "3930365" ... #> ..$ patent_number: chr [1:25] "3930365" ... #> ..$ patent_title : chr [1:25] "Fuel control system for gas turbine engine" ... #> #> $query_results #> #### Distinct entity counts across all downloadable pages of output: #> #> total_patent_count = 51,351# NOT RUN { # Will view error message in RStudio's viewer pane: search_pv( query = with_qfuns(not(text_any(patent_title = "hi"))), error_browser = rstudioapi::viewer ) # }