Skip to content

Instantly share code, notes, and snippets.

@emraher
Last active August 29, 2015 14:10
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 emraher/b773ed4b78889c877faa to your computer and use it in GitHub Desktop.
Save emraher/b773ed4b78889c877faa to your computer and use it in GitHub Desktop.
# Load "github" library
library("github")
# Load github oauth
# load("~/my_oauth/my_oauth_github")
# Get starred by user emraher
starred.by.emrah <- get.repositories.starred.by.user("emraher")
# Find index of "rgithub"
index <- seq_along(starred.by.emrah$content)[sapply(starred.by.emrah$content,
FUN=function(X) "rgithub" %in% X)]
# Check name of the repo
starred.by.emrah$content[[index]]["name"]
# $name
# [1] "rgithub"
# Stargazers of the "rgithub"
starred.by.emrah$content[[index]]["stargazers_count"]
# $stargazers_count
# [1] 26
# Watchers of the "rgithub"
starred.by.emrah$content[[index]]["watchers_count"]
# $watchers_count
# [1] 26
# Get stargazers of "rgithub" directly
stargazers <- get.stargazers("cscheid", "rgithub")
length(sapply(stargazers$content, "[[", "login"))
# [1] 26
# Get watchers of "rgithub" directly
watchers <- get.watchers("cscheid", "rgithub")
length(sapply(watchers$content, "[[", "login"))
# [1] 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment