Skip to content

Instantly share code, notes, and snippets.

View tylerlittlefield's full-sized avatar
🍓
🍋

Tyler Littlefield tylerlittlefield

🍓
🍋
View GitHub Profile
@tylerlittlefield
tylerlittlefield / merged_prs.R
Created November 21, 2018 17:37
Gather and count all your merged pull requests
library(gh)
library(tidyverse)
library(jsonlite)
gh("/search/issues?q=author:tylurp+type:pr+is:merged") %>%
toJSON() %>%
fromJSON() %>%
.$items %>%
.$pull_request %>%
.$url %>%
@tylerlittlefield
tylerlittlefield / replace_list.R
Last active November 16, 2018 20:18
Replace column values in each list element by column index
x <- list(iris[1:5, ], iris[1:5, ])
replace_list <- function(x, value, col) {
x[[col]] <- value
return(x)
}
lapply(x, replace_list, 7, 1)
#> [[1]]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species