We need to implement the following steps to extract data using the httr package in R workspace:
First, we load the httr package:
library(httr)
We then call GET function and pass it as a URL:
r <- GET("http://httpbin.org/get")
This gives us a response object that can be processed further for data. To start with, we can print out the response object to get some information about the data:
>r
Response [http://httpbin.org/get]
Date: 2019-01-18 03:45
Status: 200
Content-Type: application/json
Size: 326 B
{
"args": {},
"headers": {
"Accept": "application/json, text/xml, application/xml, */*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent...