3

I'm doing a small task that requires the usage of GitHub's APIs. Most of the data can be retrieved from the main API, but some specific information is an API itself. Here's how the main API is read by R, using jsonlite package:

enter image description here

The next task is to tell R to sum the number of labels that are 0 in each of those rows of that column "url". For that, R needs to read each API separately. I'm trying to do something like this:

library(jsonlite) issues <- fromJSON("THE API LINK") jsonapis <- issues$url apis <- fromJSON(jsonapis)

That retrieves the following error message:

Error: Argument 'txt' must be a JSON string, URL or file.

To use with URL, I'd have to copy paste each one manually - I think - and all suggestions I found only in regard to 'file' do not fit.

I have another task similar that involves reading from many APIs simultaneously, but I presume I'll be able to do finish that if I can understand this one. Can someone help me?

I apologize if this is not very clear, but this is the best I can do. Unfortunately, I'm not too comfortable in these topics and APIs is really a pain to me. Thanks in advance!

jbaums
  • 27,115
  • 5
  • 79
  • 119
Gustavo Silva
  • 159
  • 1
  • 12
  • Might you be able to construct a url using `paste()`? Then perhaps you could create a vector of URLs and pass them to `fromJSON` in a `for` loop. – Statwonk Dec 14 '15 at 02:33
  • First of all, apologies for my very late response but for the last days I've been extremely busy. Well, I may need to ask you to elaborate on that. Sorry, I'm new to R... I did a very slow test with those functions and failed miserably. [Check this bin](http://pastebin.com/DYt49Snh) Both fail and R retrieves `Error: unexpected '}' in: " stored <- fromJSON(i, txt = "URL" }"` – Gustavo Silva Dec 18 '15 at 01:01

0 Answers0