1 — Overview of R packages

setup
packages
Published

January 1, 2024

Modified

January 9, 2024

Install R packages

R comes installed with many built-in functions and tools to help do your work.

On top of this foundation referred to as base R, contributors create tools to make R easier to use and perform new tasks. These add-ons are called packages. These are made available to everyone to download for free.

Need R? Follow these installation steps.

Need access to data? Submit a Data related service request.

Packages used for qualitative analysis

General toolbox


tidyverse The tidyverse is an umbrella of helpful packages. One of the included packages is the readr package, which helps import data into R from a variety of formats.



The core tidyverse packages we’ll be using:

  • readr Load and save data stored as plain text, such as Comma Separated Values (CSVs).
  • dplyr Clean, filter, transform, summarize and join data sets.
  • stringr Edit, clean, and precisely search through text.
  • ggplot2 Plot, chart, and graph data.

See the full list of tidyverse packages at the tidyverse.


Load data

readxl Load data from Excel.
DBI Load data from databases with SQL.
haven Load SAS, SPSS, and Stata files.
janitor Clean and simplify column names and remove duplicates.


Analyze text data

tidytext Tools to make text easier to analyze. fuzzyjoin Tools to make join words that are approximately the same. lubridate Tools to format dates and perform calculations based on time.


Add R packages

To use a package you first need to install it – much like an App on your phone. Copy the text below and paste it into the RStudio console. The console is found on the left-side of the screen when you open RStudio.

new_packages <- c("tidyverse", "tidytext", "janitor", "curl", "stopwords")

install.packages(new_packages)


Then press ENTER to begin the installation. You should start to see some messages appear similar to below. These will provide information on the installation progress.


Did it work? Try running the code below to load the tidyverse package from your library and see if it is installed.

library(tidyverse)


Update R packages


There are two places to update R packages in RStudio.

1. In the Files and Plots area in the bottom right, under the Packages tab:

Click the green Update button next to Install.


2. In the Tools tab above at the top above the Code Editor:

Choose the 2nd option -> “Check for Package Updates…”