forked from AdamWilsonLabEDU/SpatialDataScience
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrades.R
More file actions
33 lines (24 loc) · 706 Bytes
/
grades.R
File metadata and controls
33 lines (24 loc) · 706 Bytes
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
# Process grade-related things....
#
#
## Participation grade
##
##
library(tidyverse)
library(tidyjson)
source("grades/secrets.R")
# 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/users/AdamWilsonLabEDU/repos", gtoken)
# Take action on http error
stop_for_status(req)
# Extract content from a request
json1 = content(req)
# Convert to a data.frame
d = jsonlite::fromJSON(jsonlite::toJSON(json1))%>%
mutate(type=ifelse(grepl("finalproject",full_name),
"final_project","case_study"))
# Subset data.frame
mutate_at(d,grepl("geo503-2018")