Skip to content

Instantly share code, notes, and snippets.

@cecilialee
Last active February 9, 2018 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cecilialee/ae5cbd3f3ff5a773e4d219da041ad229 to your computer and use it in GitHub Desktop.
Save cecilialee/ae5cbd3f3ff5a773e4d219da041ad229 to your computer and use it in GitHub Desktop.
Use morph.io API in R with httr. Then convert the content to a dataframe with jsonlite. Turn it to tibble for easier analysis. #r #httr #jsonlite
library(httr)
library(jsonlite)
resp <- GET("https://api.morph.io/cecilialee/morph-scraper/data.json",
query = list("query" = "select * from 'data'",
"key" = "Kiu/NDU9OrgwJCJ1X/+2")) # fake API
dshk <- content(resp, as = "text")
dshk_df <- fromJSON(dshk)
# library(tidyverse)
# dshk_tbl <- as.tibble(dshk_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment