If you find any typos, errors, or places where the text may be improved, please let us know by providing feedback either in the feedback survey (given during class) or by using GitLab.
Free online books:
- Efficient R Programming: Excellent book on being efficient when writing R code.
- Advanced R: Detailed book on advanced features of R.
- R Packages: Learn how to create R Packages from the basics.
- R for Data Science: Excellent open and online resource for using R for data analysis and data science.
- R Programming for Data Science: Great overview of using R for Data Science, with more of a focus on the programming side of things
- ModernDive: Statistical Inference via Data Science: Great book on using statistics and data science methods in R
- Happy Git and GitHub for the useR (highly recommended): Specifically useful is the chapter on Daily Workflows using Git
- Online book for R Markdown: The go-to reference for learning and using R Markdown
- Course material for a statistics class: Excellent course material for teaching statistics and R.
- RStudio cheatsheets: Multiple, high-quality cheatsheets you can print off to use as a handy reference
- Tidyverse style guide: To learn about how to write well styled code in R
- Tidyverse design philosophy of writing code
- Good enough practicies in scientific computing: An article listing and describing some practices to use when writing code
- Best practices in scientific computing
- Case studies and lessons for doing reproducibility
- Organizing R Source Code
- RStudio tutorial on using R Markdown
- Markdown syntax guide
- Pandoc Markdown Manual (R Markdown uses [pandoc])
Interactive sites or resources for hands-on learning:
|bookdown||Authoring Books and Technical Documents with R Markdown||Output formats and utilities for authoring books and technical documents with R Markdown.|
|broom||Convert Statistical Objects into Tidy Tibbles||Summarizes key information about statistical objects in tidy tibbles. This makes it easy to report results, create plots and consistently work with large numbers of models at once. Broom provides three verbs that each provide different types of information about a model. tidy() summarizes information about model components such as coefficients of a regression. glance() reports information about an entire model, such as goodness of fit measures like AIC and BIC. augment() adds information about individual observations to a dataset, such as fitted values or influence measures.|
||Fast aggregation of large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group using no copies at all, list columns, friendly and fast character-separated-value read/write. Offers a natural and flexible syntax, for faster development.|
|datapasta||R Tools for Data Copy-Pasta||RStudio addins and R functions that make copy-pasting vectors and tables to text painless.|
|dplyr||A Grammar of Data Manipulation||A fast, consistent tool for working with data frame like objects, both in memory and out of memory.|
|forcats||Tools for Working with Categorical Variables (Factors)||Helpers for reordering factor levels (including moving specified levels to front, ordering by first appearance, reversing, and randomly shuffling), and tools for modifying factor levels (including collapsing rare levels into other, ‘anonymising’, and manually ‘recoding’).|
|fs||Cross-Platform File System Operations Based on ‘libuv’||A cross-platform interface to file system operations, built on top of the ‘libuv’ C library.|
|ggplot2||Create Elegant Data Visualisations Using the Grammar of Graphics||A system for ‘declaratively’ creating graphics, based on "The Grammar of Graphics". You provide the data, tell ‘ggplot2’ how to map variables to aesthetics, what graphical primitives to use, and it takes care of the details.|
|glue||Interpreted String Literals||An implementation of interpreted string literals, inspired by Python’s Literal String Interpolation <https://www.python.org/dev/peps/pep-0498/>; and Docstrings <https://www.python.org/dev/peps/pep-0257/>; and Julia’s Triple-Quoted String Literals <https://docs.julialang.org/en/v1.3/manual/strings/#Triple-Quoted-String-Literals-1>;.|
|googledrive||An Interface to Google Drive||Manage Google Drive files from R.|
|haven||Import and Export ‘SPSS’, ‘Stata’ and ‘SAS’ Files||Import foreign statistical formats into R via the embedded ‘ReadStat’ C library, <https://github.com/WizardMac/ReadStat>;.|
|here||A Simpler Way to Find Your Files||Constructs paths to your project’s files. The ‘here()’ function uses a reasonable heuristics to find your project’s files, based on the current working directory at the time when the package is loaded. Use it as a drop-in replacement for ‘file.path()’, it will always locate the files relative to your project root.|
|janitor||Simple Tools for Examining and Cleaning Dirty Data||The main janitor functions can: perfectly format data.frame column names; provide quick counts of variable combinations (i.e., frequency tables and crosstabs); and isolate duplicate records. Other janitor functions nicely format the tabulation results. These tabulate-and-report functions approximate popular features of SPSS and Microsoft Excel. This package follows the principles of the "tidyverse" and works well with the pipe function %>%. janitor was built with beginning-to-intermediate R users in mind and is optimized for user-friendliness. Advanced R users can already do everything covered here, but with janitor they can do it faster and save their thinking for the fun stuff.|
|knitr||A General-Purpose Package for Dynamic Report Generation in R||Provides a general-purpose tool for dynamic report generation in R using Literate Programming techniques.|
|lubridate||Make Dealing with Dates a Little Easier||Functions to work with date-times and time-spans: fast and user friendly parsing of date-time data, extraction and updating of components of a date-time (years, months, days, hours, minutes, and seconds), algebraic manipulation on date-time and time-span objects. The ‘lubridate’ package has a consistent and memorable syntax that makes working with dates easy and fun. Parts of the ‘CCTZ’ source code, released under the Apache 2.0 License, are included in this package. See <https://github.com/google/cctz>; for more details.|
|patchwork||The Composer of Plots||The ‘ggplot2’ package provides a strong API for sequentially building up a plot, but does not concern itself with composition of multiple plots. ‘patchwork’ is a package that expands the API to allow for arbitrarily complex composition of plots by, among others, providing mathematical operators for combining multiple plots. Other packages that try to address this need (but with a different approach) are ‘gridExtra’ and ‘cowplot’.|
|purrr||Functional Programming Tools||A complete and consistent functional programming toolkit for R.|
|readr||Read Rectangular Text Data||The goal of ‘readr’ is to provide a fast and friendly way to read rectangular data (like ‘csv’, ‘tsv’, and ‘fwf’). It is designed to flexibly parse many types of data found in the wild, while still cleanly failing when data unexpectedly changes.|
|readxl||Read Excel Files||Import excel files into R. Supports ‘.xls’ via the embedded ‘libxls’ C library <https://github.com/libxls/libxls>; and ‘.xlsx’ via the embedded ‘RapidXML’ C++ library <http://rapidxml.sourceforge.net>;. Works on Windows, Mac and Linux without external dependencies.|
|rio||A Swiss-Army Knife for Data I/O||Streamlined data import and export by making assumptions that the user is probably willing to make: ‘import()’ and ‘export()’ determine the data structure from the file extension, reasonable defaults are used for data import and export (e.g., ‘stringsAsFactors=FALSE’), web-based import is natively supported (including from SSL/HTTPS), compressed files can be read directly without explicit decompression, and fast import packages are used where appropriate. An additional convenience function, ‘convert()’, provides a simple method for converting between file types.|
|rmarkdown||Dynamic Documents for R||Convert R Markdown documents into a variety of formats.|
|stringr||Simple, Consistent Wrappers for Common String Operations||A consistent, simple and easy to use set of wrappers around the fantastic ‘stringi’ package. All function and argument names (and positions) are consistent, all functions deal with "NA"’s and zero length vectors in the same way, and the output from one function is easy to feed into the input of another.|
|tibble||Simple Data Frames||Provides a ‘tbl_df’ class (the ‘tibble’) that provides stricter checking and better formatting than the traditional data frame.|
|tidyr||Tidy Messy Data||Tools to help to create tidy data, where each column is a variable, each row is an observation, and each cell contains a single value. ‘tidyr’ contains tools for changing the shape (pivoting) and hierarchy (nesting and ‘unnesting’) of a dataset, turning deeply nested lists into rectangular data frames (‘rectangling’), and extracting values out of string columns. It also includes tools for working with missing values (both implicit and explicit).|
|tidyverse||Easily Install and Load the ‘Tidyverse’||The ‘tidyverse’ is a set of packages that work in harmony because they share common data representations and ‘API’ design. This package is designed to make it easy to install and load multiple ‘tidyverse’ packages in a single step. Learn more about the ‘tidyverse’ at <https://tidyverse.org>;.|
|usethis||Automate Package and Project Setup||Automate package and project setup tasks that are otherwise performed manually. This includes setting up unit testing, test coverage, continuous integration, Git, ‘GitHub’, licenses, ‘Rcpp’, ‘RStudio’ projects, and more.|
|vroom||Read and Write Rectangular Text Data Quickly||The goal of ‘vroom’ is to read and write data (like ‘csv’, ‘tsv’ and ‘fwf’) quickly. When reading it uses a quick initial indexing step, then reads the values lazily , so only the data you actually use needs to be read. The writer formats the data in parallel and writes to disk asynchronously from formatting.|