issues: Issue data for the dplyr repo from github API

Description Usage Format Examples

Description

Issue data for the dplyr repo from github API

Usage

1

Format

JSON

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
library(dplyr)

# issues is a long character string
nchar(issues)

# Let's make it a tbl_json object
issues %>% as.tbl_json

# It begins as an array, so let's gather that
issues %>% gather_array

# Now let's spread all the top level values
issues %>% gather_array %>% spread_all %>% glimpse

# Are there any top level objects or arrays?
issues %>% gather_array %>% gather_object %>% json_types %>%
  count(name, type) %>%
  filter(type %in% c("array", "object"))

# Count issues labels by name
labels <- issues %>%
  gather_array %>%                    # stack issues as "issue.num"
  spread_values(id = jnumber(id)) %>% # capture just issue id
  enter_object(labels) %>%            # filter just those with labels
  gather_array("label.index") %>%     # stack labels
  spread_all
labels %>% glimpse

# Count number of distinct issues each label appears in
labels %>%
  group_by(name) %>%
  summarize(num.issues = n_distinct(id))

jeremystan/tidyjson documentation built on May 17, 2017, 6:14 p.m.