![]() # Create a boolean vector to represent free columns (1000 should be plenty!) History_logs % mutate(branch = NA_integer_) There’s surely a better way to do this, but here’s one (very untidy) method: # Start with NA #> 10 17:55:23 f186615a Lionel Henry Support quosures i…įinally, be sure to assign branch numbers to commits. #> 9 17:55:23 64a00c7d Lionel Henry Use proper quosure… #> 5 17:55:23 b2144a8e Lionel Henry Mention tidy eval … #> 3 17:55:23 dc3c9855 Lionel Henry Call formula inter… #> 1 18:42:25 3c9c504f Lionel Henry Merge pull request… Mutate(parents = str_split(parents, " ")) The code below converts this to a list-column of character vectors (let Jenny Bryan teach you more about this here): history_logs % The entire git commit history is now a tidy data frame (tibble)! We’ll finish this section with two minor additions.įirst, the parents column can contain space-separated strings when a commit was a merge of multiple, for example. #> datetime commit parents author subject Str_split_fixed(option_delim, length(log_format_options)) %>% ![]() The R code below executes this for the entire repo, captures the output (via intern = TRUE), splits commit strings into vectors of values (thanks to stringr), and converts them to a named tibble. #> 17:55:23 dc3c9855 1182b9f3 Lionel Henry Call formula interface classic instead of historical #> 18:42:25 3c9c504f cab8a54e 449bc039 Lionel Henry Merge pull request #2491 from tidyverse/tidyeval-facets Examine the last few commits via: system(glue('git -C -3')) You can now access the git history of the local repo using git log (making sure to target the right directory with -C). #> "data-raw" "DESCRIPTION" "ggplot2.Rproj" #> "CONTRIBUTING.md" "cran-comments.md" "data" Repo_url "_pkgdown.yml" "appveyor.yml" "codecov.yml" system() invokes these commands from R (instead of using a command-line directly) and the glue package beautifully handles the strings for us. The R code below clones the ggplot2 git repo into a temporary directory called "git_repo" (let Alexander Matrunich teach you more about temp directories and files here). is optional but useful for us to clone into a specific location. We’ll explore the open-source ggplot2 repo by copying it to our local machine with git clone, typically run on a command-line like: git clone įind the for projects by clicking “Clone or download”. Part 1: Git repo to a tidy data frame # Get a git repo # ![]() Install and load these packages to follow along: # Parts 1 and 2 This post – intended for intermediate R users – will help you answer these sorts of questions using tidy R tools. MaGuide to tidy git here to help you embark on git repo analyses!Įver wondered who contributes to git repos? How their contributions have changed over time? What sort of conventions different authors use in their commit messages? Maybe you were inspired by Mara Averick to contribute to tidyverse packages and wonder how you fit in? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |