Skip to content

Instantly share code, notes, and snippets.

@ellisvalentiner
Created August 7, 2017 19:01
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 ellisvalentiner/2fa6745126100c26d8b7b60eff1bd41a to your computer and use it in GitHub Desktop.
Save ellisvalentiner/2fa6745126100c26d8b7b60eff1bd41a to your computer and use it in GitHub Desktop.
library(purrr)
library(dplyr)
library(tidyr)
deps <- readLines("~/Desktop/deps.txt")
df <- deps %>%
map(strsplit, split=": ") %>%
flatten %>% map_if(~length(.x) == 1L, ~c(.x, NA)) %>%
do.call(rbind.data.frame, .)
colnames(df) <- c("pkg", "dep")
brew_dependencies <- df %>%
mutate(
dep = stringr::str_split(dep, pattern = " ")
) %>%
unnest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment