class: center, middle, inverse, title-slide .title[ # Building and Distributing R Packages using GitHub ] .subtitle[ ## Using GitHub for Open-Source Analytics, Reporting, and Dissemination of Research ] .author[ ### Damian Betebenner ] .institute[ ### Center for Assessment
] .date[ ### April 21st, 2022 (updated: May 18th, 2022)
NCME 2022 Annual Meeting ] --- layout: true <!-- Add Footer Manually - might only be able to have ONE 'layout: true' slide --> <!-- this adds the footer to all slides, depends on footer class in css --> <div class="footer" style="left: 5%;"><img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" style = "max-width: 40%; opacity: 0.5;"></img></div> <div class="footer" style="left: 7.5%;"><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg" style = "max-width: 40%; opacity: 0.5;"></img></div> <div class="footer" style="left: 40%;"><a class="footer" href="https://github.com/CenterForAssessment/packageSkeletonForR">R Packages with GitHub</a></div> --- class: inverse, center, middle # R --- class: highlight-last-item <style type="text/css"> h1 > img { width: 10% } </style> #  -- - Open soure software environment originally developed for statistical analysis (but now useful for lots more) -- - Has become one of the most prominent environmetns for performing and developing data analytics/statistics -- - Applicable to many other things (this presentation and the website on which it is based was created using R) -- - One of its greatest strengths is its extensibility -- - Allows users to create and distribute customized R software -- - Currently 19,002 package on CRAN and many more available only on GitHub (which is a big part of what I'm going to talk about) -- - <hr /> --- class: inverse, center, middle # GitHub --- class: highlight-last-item # GitHub -- - GitHub is a code hosting platform for version control and collaboration -- - Collaboration without coordination -- - Often used for software development but is incredibly useful for data analytics -- - <hr/> --- class: inverse, center, middle # GitHub # + # R # = # Superpower --- class: highlight-last-item # GitHub + R -- - The combination of GitHub and R has been the foundation of my work for the last 15 years. -- - The combination supports and improves: -- - Reproducibility of analytics -- - Collaboration amongst team members -- - Dissemination of analytics and findings -- - If data analysis and reporting results is your career, I can't recommend the combination of GitHub + R enough. -- - <hr/> --- class: highlight-last-item # R Packages -- - R provides a simple to learn way of extending base R by creating packages -- - The packages can be easily shared with other to share analytic or other extended R functionality -- - --- class: highlight-last-item # R Packages -- - Packages can be shared and installed by others in a multide of ways: -- - Email a zipped bundle to another person who can install it. (very oldschool and clunky) -- - Submit it to CRAN and use `install.packages()` to install the package. (Good for "official versions/archiving") -- - Build it on GitHub and use `remotes::install_github()` or `devtools::install_github` to install off of GitHub. (Get version control in addition to package hosting) -- - The definitive guide on R package construction is [Writing R Extensions](https://cran.r-project.org/doc/manuals/r-release/R-exts.html) available on CRAN. -- - <hr/> --- class: highlight-last-item # packageSkeletonForR -- - We create a GitHub repo that is an R package skeleton for R -- - [packageSkeletonForR](https://github.com/CenterForAssessment/packageSkeletonForR) -- - The skeleton contains many of the pieces that you'll need to have in order to have a package -- - The skeleton also contains several additional pieces (a website) describing the contents of the repo and how it works -- - <hr/> --- # packageSkeletonForR <img src="Building_and_Distributing_R_Packages_Using_GitHub_files/figure-html/unnamed-chunk-2-1.png" width="80%" style="display: block; margin: auto;" /> --- class: highlight-last-item # R Package Contents -- - A folder `R` that contains your R scripts/functions -- - A folder `inst` that contains `CITATION` and `NEWS` files -- - A folder `man` that contains the manual pages associated with your exported functions -- - A folder `tests` that contains tests associated with your functions (optional but recommended) -- - A folder `vignettes` that contains RMarkdown vignettes associated with your package (optional but recommended) -- - A file `DESCRIPTION` that contains text describing the package -- - A file `NAMESPACE` that specific what gets imported and exported to/from the package. -- - <hr/> --- class: highlight-last-item # R Package Contents -- - A Folder `.github` that contains a file allowing one to use GitHub to compile the R package and test for errors. -- - A folder `docs` that contains the source code associated with the GitHub hosted website for the package (created by R package `packagePages` using the function `projectPages`) -- - A file `.Rbuildignore` that specifies which files/folders to ignore when the package gets built. -- - A file `.appveyor` that specific another continuous integration application (appveyor). Probably redundant with GitHub actions -- - Files `README.md`, `NEWS.md` and `LICENSE.md` that are markdown based and provide information about the GitHub repo. -- - A file `_pkgdown` which provides the structure for the dropdown menu of the website associated with the repo. -- - <hr/> --- class: highlight-last-item # Package Installation -- ### To install the package -- - `remotes::install_github("centerforassessment/packageSkeletonForR")` -- - Changes to the package can be made via commits to the GitHub repo which become `pull requests` -- - Multiple people can make commits with different permissions as <br/> to who can merge in `pull requests` -- - <hr/>