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
This output is a list of length 4, each containing a nested list. It is not the cleanest output, but it rarely is. But all the information you could want is buried somewhere here.
97
+
This output is a list of length 8, each containing a nested list. It is not the cleanest output, but it rarely is. But all the information you could want is buried somewhere here.
98
98
99
99
100
100
This apply statement gets information on the title of each of the works returned from our search for "Vonnegut".
Time to read a bit of API documentation! The Open Library API documentation is at https://openlibrary.org/developers/api. For this problem, I want you to query by subject and extract relevant details with your knowledge of `httr`/`jsonlite` and data.frame/list objects. The documentation for subject queries is at:
155
+
156
+
https://openlibrary.org/dev/docs/api/subjects
157
+
158
+
159
+
160
+
161
+
162
+
How many books were published on the `subject` of love?
163
+
164
+
165
+
```{r}
166
+
167
+
168
+
169
+
```
170
+
171
+
172
+
Who has written the most books on love?
173
+
174
+
175
+
```{r}
176
+
177
+
178
+
179
+
```
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
The Art Institute of Chicago also has an open API (https://api.artic.edu/docs/#quick-start).
188
+
189
+
Create a histogram of the `colorfulness` score of the first 1000 paintings (https://api.artic.edu/api/v1/artworks).
190
+
191
+
*Hint*: you will need to use the `page` and `limit` arguments to get 1000 paintings.
192
+
193
+
194
+
```{r}
195
+
196
+
197
+
```
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
154
209
> Side fun note: You can access GitHub info through API calls as well
@@ -190,6 +243,30 @@ That list (`tadInfo`) also has some links to other API calls that could be made.
190
243
191
244
192
245
246
+
There are some arguments that can be passed to API calls (every API ideally has good documentation and goes over this). For instance, GitHub has page limits on the number of results reported, but you can set the number of results per page using the `per_page` argument. Using this, write a loop to assemble a data.frame of followers of `torvalds` (the creator of Linux and git).
247
+
248
+
**Hints**: you'll likely need to loop over multiple calls, since `per_page` is capped at 100, and you may also need to specify `page` argument.
0 commit comments