-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
99 lines (99 loc) · 2.87 KB
/
.Rhistory
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#install.packages("jsonlite")
library(jsonlite)
#install.packages("httpuv")
library(httpuv)
#install.packages("httr")
library(httr)
# Can be github, linkedin etc depending on application
oauth_endpoints("github")
# Change based on what you
myapp <- oauth_app(appname = "fims-status",
key = "0445d3e283f2a8bd4a8a",
secret = "46e44c0be8ce2b11ffe49dfefc06a4a81df2a0e8 ")
# Get OAuth credentials
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp)
req <- GET("https://api.github.com/orgs/NOAA-FIMS/repos", gtoken)
# Use API
gtoken <- config(token = github_token)
req <- GET("https://api.github.com/orgs/NOAA-FIMS/repos", gtoken)
req
# Change based on what you
myapp <- oauth_app(appname = "fims-status",
key = "7a9747db4fd7955c5bdf",
secret = "3f1d1dfeb9613d758e3b9e5785c1871a7f592e4c")
# Get OAuth credentials
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp)
# Use API
gtoken <- config(token = github_token)
req <- GET("https://api.github.com/orgs/NOAA-FIMS/repos", gtoken)
req
# Take action on http error
stop_for_status(req)
# Extract content from a request
json1 = content(req)
# Convert to a data.frame
gitDF = jsonlite::fromJSON(jsonlite::toJSON(json1))
gitDF
names(gitDF)
unique(gitDF$full_name)
# Subset data.frame
gitDF[gitDF$full_name == "NOAA-FIMS/FIMS", ]
req <- GET("https://api.github.com/orgs/NOAA-FIMS/FIMS/issues", gtoken)
# Take action on http error
stop_for_status(req)
# Extract content from a request
json1 = content(req)
# Convert to a data.frame
gitDF = jsonlite::fromJSON(jsonlite::toJSON(json1))
gitDF
install.packages("gh")
require(gh)
gh("orgs/NOAA-FIMS/FIMS")
gh("/orgs/NOAA-FIMS/FIMS")
req <- GET("https://api.github.com/repos/NOAA-FIMS/FIMS/issues", gtoken)
# Take action on http error
stop_for_status(req)
# Extract content from a request
json1 = content(req)
# Convert to a data.frame
gitDF = jsonlite::fromJSON(jsonlite::toJSON(json1))
gitDF
names(gitDF)
rm(json1)
gitDF$number
gitDF %>% select("number", "title", "updated_at","milestone")
require(dplyr)
gitDF %>% select("number", "title", "updated_at","milestone")
gitDF %>% select("number", "title", "updated_at","milestone.title")
sub <- gitDF %>% select("number", "title", "updated_at","milestone")
str(sub)
sub <- gitDF %>% select("number", "title")
sub
names(gitDF)
sub <- gitDF %>% select("number", "title", "labels")
sub
str(sub)
names(gitDF)
gitDF$state
sub <- gitDF %>% select("number", "title", "labels")
sub$labels
require(roomba)
remotes::install_github("cstawitz/roomba")
require(roomba)
sub$labels %>% roomba()
sub$labels %>% roomba(cols=c("name", "color")
)
sub$labels[[1]] %>% roomba(cols=c("name", "color")
)
sub$labels[[1]]
sub$labels
sub$labels[[2]] %>% roomba(cols=c("name", "color"))
sub$labels[[3]] %>% roomba(cols=c("name", "color"))
sub %>% roomba(cols=c("name", "color"))
kable(sub)
require(kableExtra)
require(kable)
sub[,c("number", "title")]
knitr
require(knitr)
knitr::kable(sub[,c("number", "title")])