Some tasks are common to almost all users, though, regardless of subject area: data import, data wrangling and data visualization. The table below show my favorite go-to packages for one of these three tasks (plus a few miscellaneous ones tossed in). The package names in the table are clickable if you want more information. To find out more about a package once you've installed it, type help(package = "packagename") in your R console (of course substituting the actual package name ).

purrr makes it easy to apply a function to each item in a list and return results in the format of your choice. It's more complex to learn than the older plyr package, but also more robust. And, its functions are more standardized than base R's apply family -- plus it's got functions for tasks like error-checking. CRAN.

Easily read data from and post data to Google Sheets. While no longer under active development (it will be replaced by the googledrive and googlesheets4 packages), I find the package still works well. CRAN.

Base R handles most of these functions; but if you have huge files, this is a speedy and standardized way to read tabular files such as CSVs into R data frames, as well as plain text files into character strings with read_file. CRAN.

There are a number of useful functions in here. Two of my favorites: describe, a more robust summary function, and Cs, which creates a vector of quoted character strings from unquoted comma-separated text. Cs(so, it, goes) creates c("so", "it", "goes"). CRAN.

Data copy and paste: Meet reproducible research. If you've copied data from the Web, a spreadsheet, or other source into your clipboard, datapasta lets you paste it into R as an R object, with the code to reproduce it. It includes RStudio add-ins as well as command-line functions for transposing data, turning it into markdown format, and more. CRAN.

Even if you're not interested in analyzing and graphing financial investment data, quantmod has easy-to-use functions for importing economic as well as financial data from sources like the Federal Reserve. CRAN.

Another financial package that's useful for importing, analyzing and visualizing data, integrating aspects of other popular finance packages as well as tidyverse tools. With thorough documentation. CRAN.

tidyr initially won me over with specialized functions like fill (fill in missing columns from data above) and replace_na. But now I also use it for its main purpose too: helping you change data row and column formats from "wide" to "long". CRAN.

It's rare that I'd recommend a package that hasn't been updated in years, but the cSplit() function solves a rather complex shaping problem in an astonishingly easy way. If you have a data frame column with one or more comma-separated values (think a survey question with "select all that apply"), this is worth an install if you want to separate each item into its own new data frame row.. CRAN.

This package gave us the %>% symbol for chaining R operations, but it's got other useful operators such as %<>% for mutating a data frame in place and and . as a placeholder for the original object being operated upon. CRAN.

Numerous functions for text manipulation. Some are similar to existing base R functions but in a more standard format, including working with regular expressions. Some of my favorites: str_pad and str_trim. CRAN.

Add R to a markdown document and easily generate reports in HTML, Word and other formats. A must-have if you're interested in reproducible research and automating the journey from data analysis to report creation -- as is the rmarkdown package. CRAN.

RStudio add-in offers a menu for R Markdown formatting commands, so you no longer need to remember and/or type code for things like making an HTML list or embedding a YouTube video. And, since add-in commands can be assigned custom keyboard shortcuts, you can create your own shortcuts for tasks like bolding text. GitHub.

This RStudio add-in offers a drag-and-drop interface for ggplot2. And, it generates codes for the graph you create with the GUI. It's a useful tool for exploring different color palettes and themes, even if you're comfortable creating your visualizations directly in R. CRAN.

This html widget library is especially useful for scatterplots where you want to view multiple regression options. However, it does much more than that, including line and bar charts with legends and tooltips. GitHub hrbrmstr/taucharts.

Not a designer? RColorBrewer helps you select color palettes for your visualizations. CRAN.

Note: For even more palettes, check out packages viridis for colors that print well in greyscale and are easier to read if you're color blind, pals, rcartcolor for map colors, colorr for sports-team colors, nord for "Northern-themed Color palettes," and wesanderson for color schemes used by director Wes Anderson.

This package makes it much easier to do GIS work in R. Simple features protocols make geospatial data look a lot like regular data frames, while various functions allow for analysis such as determining whether points are in a polygons. A GIS game-changer for R. CRAN.

Although I don't use this package often for its main purpose of pulling down background map tiles, it's my go-to for geocoding up to 2,500 addresses with the Google Maps API with its geocode and mutate_geocode functions. CRAN.

This is a useful geocoding alternative, especially when ggmap generates messages that you're over your Google Maps API quota when you're not. It uses the geocod.io service. An API key is needed, but you can get one free that includes 2,500 lookups a day. GitHub hrbrmstr/rgeocodio.

These package offer an easy way to read in shape files and join data files with geographic info, as well as do some exploratory mapping. Recent functionality adds support for simple features, interactive maps and creating leaflet objects. Plus, tmaptools::palette_explorer() is a great tool for picking ColorBrewer palettes. CRAN.

Basic data cleaning made easy, such as finding duplicates by multiple columns, making R-friendly column names and removing empty columns. It also has some nice tabulating tools, like adding a total row, as well as generating tables with percentages and easy crosstabs. And, its get_dupes() function is an elegant way of finding duplicate rows in data frames, either based on one column, several columns, or entire rows. CRAN.

car's recode function makes it easy to bin continuous numerical data into categories or factors. While base R's cut accomplishes the same task, I find recode's syntax to be more intuitive - just remember to put the entire recoding formula within double quotation marks. dplyr's case_when() function is another option worth considering. CRAN.

R interface to the Plotly JavaScript library that was open-sourced in late 2015. Basic graphs have a distinctive look which may not be for everyone, but it's full-featured, relatively easy to learn (especially if you know ggplot2) and includes a ggplotly() function to turn graphs created with ggplot2 interactive. CRAN.

R wrapper for the robust and well documented Highcharts JavaScript library, one of my favorite choices for presentation-quality interactive graphics. The package uses ggplot2-like syntax, including options for handling both long and wide data, and comes with plenty of examples. Note that a paid Highcharts license is needed to use this for commercial or government work (it's free for personal and non-profit projects). CRAN. . CRAN.

Another alternative for binary file storage (R-only), fst was built for fast storage and retrieval, with access speeds above 1 GB/sec. It also offers compression that doesn't slow data access too much, as well as the ability to import a specific range of rows (by row number). CRAN.

devtools has a slew of functions aimed at helping you create your own R packages, such as automatically running all example code in your help files to make sure everything works. Requires Rtools on Windows and XCode on a Mac. On CRAN.

If you want to install R packages from GitHub, devtools was long the go-to. However, it has a ton of other functions and some hefty dependences. remotes is a lighter-weight alternative if all you want is to install packages from GitHub as well as Bitbucket and some other sources. CRAN. (ghit is another option, but is GitHub-only.)

Do you want to install a package from GitHub without typing out the GitHub user name along with the repo name? Whether because you can't remember a package's GitHub owner's name, that name is long/complex to type out, or you just want to save yourself a little typing, this package is a handy option. Simply run githubinstall("packagename") and the package will suggest an account; then you respond Y to install or n if it's the wrong one. It even includes fuzzy matching if you misspell a package name!

Initially aimed at package development, usethis now includes useful functions for any coding project. Among its handy features are an edit family that lets you easily update your .Renvironment and .Rprofile files. On CRAN, but install GitHub version from "r-lib/usethis" for latest updates.

This package is another that aims to solve one problem, and solve it well: package installation. The main functions will loadi a package that's already installed or installing it first if it's not available. While this is certainly possible to do with base R's require() and an if statement, p_load() is so much more elegant for CRAN packages, or p_load_gh() for GitHub. Other useful options include p_temp(), which allows for a temporary, this-session-only package installation. CRAN.

R wrapper for the powerful and flexible ECharts JavaScript library. It features dozens of chart and graph types, from bar and line charts to sunbursts, heat maps, and geographical maps. Hundreds of customizations not explicitly mentioned in the package docs are nevertheless available; you just need to peruse the original ECharts documentation. (ECharts is an Apache Software Foundation incubator project.) CRAN.

To be honest, I rarely need the ability create "geofacets" -- maps with same-sized blocks in geospatially appropriate locations. However, this package is so cool that I had to include it. Geofaceting is best understood by looking at an example. The package lets you create your own geofacet visualizations using ggplot2 and built-in grids such as US states, EU countries and San Francisco Bay Area counties. Even more impressive, it comes with design-your-own geofacet grid capabilities. CRAN.

If you know Python as well as R, this package offers a suite of tools for calling Python from within R, as well as "translating" between R and Python objects such as Pandas data frames and R data frames. CRAN.

Do you use Slack? If so, you can send messages and files into a Slack channel, as long as you've got a token from that Slack. Useful to run analysis and then quickly share results with a team. GitHub hrbrmstr/slackr

This is pretty much pure fun. Yes, getting an audible notification when code finishes running or encounters an error could be useful; but here, the available sounds include options like a fanfare flourish, a Mario Brothers tune, and even a scream. CRAN.

beep("wilhelm")

Rasmus Bååth

A few important points for newbies:

To install a package from CRAN, use the command install.packages("packagename") -- of course substituting the actual package name for packagename and putting it in quotation marks. Package names, like pretty much everything else in R, are case sensitive.

To install from GitHub, it's easiest to use the install-github function from the devtools package, using the format devtools::install_github("githubaccountname/packagename"). That means you first want to install the devtools package on your system with install.packages("devtools"). Note that devtools sometimes needs some extra non-R software on your system -- more specifically, an Rtools download for Windows or Xcode for OS X. There's more information about devtools here.

In order to use a package's function during your R session, you need to do one of two things. One option is to load it into your R session with the library("packagename") or require("packagename"). The other is to call the function including the package name, like this: packagename::functioname(). Package names, like pretty much everything else in R, are case sensitive.