Site Last Updated: May 16, 2020
New R users should check out the R basics, visualization, and econometrics pages.
Python doesn’t have a monopoly on machine learning; check out my R for machine learning page.
I have a Google Scholar profile, from my previous life as an academic.
I recommend writing and maintaining a script that keeps track of all the packages you regularly use. When re-imaging a workstation, or upgrading to the newest version of R, you can simply run it once (instead of installing packages one at a time). Here is an example:
install_packages = function(pkg) {
new_pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new_pkg))
install.packages(new_pkg, dependencies = T, Ncpus = 4)
}
packages = c(
"devtools", # R Development Tools
"tidyverse", # dplyr, tidyr, readr, readxl, haven, lubridate, ggplot2, etc.
"janitor", # Clean Dirty Data
"plm", # Panel Linear Models
"statnet" # Network Analysis
)
install_packages(packages)
rm(install_packages, packages)
It’s worth your time to look for useful RStudio add-ins every so often. There are two add-ins in particular that make my life substantially easier:
For ease of use, I assign a keyboard shortcut to both of these add-ins in RStudio (Tools > Modify Keyboard Shortcuts).
devtools::install_github("seasmith/AlignAssign") # Align Assignment Operators
devtools::install_github("sfr/RStudio-Addin-Snippets") # Convert Slashes
You can avoid using the library()
command with the power of lapply()
when more than a handful of packages need to be loaded. Combine suppressMessages()
with invisible()
to completely suppress output.