Skip to content

Instantly share code, notes, and snippets.

@ettorerizza
Created December 28, 2017 20:43
Show Gist options
  • Save ettorerizza/6a7749841cc3d9e90c75e939dfac6a3b to your computer and use it in GitHub Desktop.
Save ettorerizza/6a7749841cc3d9e90c75e939dfac6a3b to your computer and use it in GitHub Desktop.
How to use jq with R
library(jqr)
data <- readr::read_file("tweets.json")
data %>% keys()
data %>% jq("{id: .id, hashtag: .entities.hashtags[].text}",
"[.id, .hashtag]") %>% jsonlite::toJSON()
stri <- "--h"
cmd <- sprintf("jq %s", stri)
system(command = cmd, intern = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment