So what I can do is actually use the content function to extract
the JSON data, so this content function
will actually recognize that it's JSON data.
And create it's going to use the from JSOBN function from the R JSON
IO package, so that will return sort of a structured R object.
Which is a little bit hard to read I font so what
I'm going to do is I'm going to use the JSON lite package to reformat
it as a I data frame, so what I do is I take
the JSON structure that I got out from the original command to content.
And I convert that struc, structured R objects back into JSON.
And then I use the JSON lite version of
the from JSON argument to create a data frame.
And so, what this data frame is now is a data
frame where each row corresponds to a tweet in my home timeline.
And so here you can see I'm going to look at the first row of this data frame.
Which is at the time that I extracted the data.
The most recent tweet in my home timeline.
I'm going to look at the first four columns.
The first four columns tell me the time that the tweet was created, the ID number
for the tweet, the ID string here and then it's actually the text of the tweet.
So this is the tweet that was the most
recent tweet when I collected the data off the internet.
So you can do this to actually extract information from Twitter.
This is actually just the request for how do you
actually collect information about what's happening on my home timeline.
But, there's a whole bunch of other requests that you can do.
There's a bunch of different data that you can get access to through Twitter.
And so, how did I know what URL to use?
You actually go into the do, the documentation for the Twitter API, so this
is the same website as before only I'm going to look at the Twitter documentation
and what I'll get to see is what URL, see it says resource URL
down here, and that's the URL I'm going to be passing to my Get command.
It also has a bunch of parameters down here.
And so, if you look up how to format which parameters to
send to an API You can actually send a bunch of different parameters
say you can it how many tweets to collect from what time
to collect it and so forth depending on what URL you are accessing.