You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: vignettes/citation-networks.Rmd.orig
+44-46
Original file line number
Diff line number
Diff line change
@@ -9,16 +9,15 @@ vignette: >
9
9
10
10
```{r, include = FALSE}
11
11
knitr::opts_chunk$set(
12
-
collapse = TRUE,
13
-
comment = "#>",
12
+
collapse = TRUE,
13
+
comment = "#>",
14
14
warning = FALSE,
15
15
message = FALSE,
16
-
dev = "png",
17
16
fig.cap = ""
18
17
)
19
18
```
20
19
> Important API Change
21
-
>
20
+
>
22
21
> The new version of the API requires an API key, or all of your requests will be blocked. See the [API Changes](api-changes.html#an-api-key-is-required-1) page.
23
22
24
23
@@ -33,7 +32,6 @@ library(visNetwork)
33
32
library(magrittr)
34
33
library(stringr)
35
34
library(knitr)
36
-
library(webshot2)
37
35
38
36
# Write a query to pull patents assigned to the CPC code of "Y10S707/933"
@@ -66,10 +67,11 @@ Check out the [writing queries vignette](writing-queries.html) for more details
66
67
67
68
## Fields
68
69
69
-
Each endpoint has a different set of fields. The new version of the API allows all fields to be queried. In the first example, we didn't specify which fields we wanted to retrieve so we were given the default set. You can specify which fields you want using the `fields` argument:
70
+
Each endpoint has a different set of fields. The new version of the API allows all fields to be queried. You can specify which fields you want using the `fields` argument. If you don't specify any, you will get
71
+
the primary key(s) for the specified endpoint.
70
72
71
73
```{r}
72
-
# search_pv defaults the endpoint parameter to "patents" if not specified
74
+
# search_pv defaults the endpoint parameter to "patent" if not specified
73
75
result = search_pv(
74
76
query = '{"_gte":{"patent_date":"2007-01-01"}}',
75
77
fields = c("patent_id", "patent_title")
@@ -153,41 +155,6 @@ Your choice of endpoint determines two things:
153
155
154
156
Most of the time you will want to use the patent endpoint. Note that you can still effectively filter on fields that are not at the patent-level when using the patent endpoint (e.g., you can filter on assignee name or CPC category). This is because patents are relatively low-level entities. For higher level entities like assignees, if you filter on a field that is not at the assignee-level (e.g., inventor name), the API will return data on any assignee that has at least one inventor whose name matches your search, which is probably not what you want.
155
157
156
-
## Casting fields
157
-
158
-
The API now returns most data fields as an appropriate data type (e.g., numeric). There are, however,
159
-
a few fields that are returned as strings rather than integers and there are 33 date fields now.
160
-
There are also two rule_47_flags, one returned by the patent endpoint, the other by the publication endpoint.
161
-
The former is a boolean while the latter is a string that can be cast to a boolean. Lastly, most
162
-
of the document numbers are numeric though there are two instances where they are strings that can
163
-
be cast to integers. You can cast all fields to their preferred R types using `cast_pv_data()`:
164
-
165
-
```{r}
166
-
library(knitr)
167
-
168
-
# These fields are received as strings and would be cast to integers
0 commit comments