</>
Skip to content
R lessons (20/41)

R — Packages

Installing packages

# Install from CRAN
install.packages("ggplot2")
install.packages("dplyr")

# Install from GitHub
# install.packages("devtools")
devtools::install_github("tidyverse/dplyr")

Loading packages

# Load package
library(ggplot2)

# Use with :: (no need to load)
dplyr::filter(data, x > 5)

# Search
find.package("ggplot2")

Popular packages

PackagePurpose
dplyrData manipulation
ggplot2Data visualization
tidyrData tidying
readrRead data
stringrString manipulation
lubridateDate/time
purrrFunctional programming
forcatsFactor manipulation
readxlRead Excel files
jsonliteRead/write JSON

Package management

# List installed packages
installed.packages()

# Update packages
update.packages()

# Remove package
remove.packages("package_name")

# Check package version
packageVersion("ggplot2")

Mini Practice

Write R code that:

  1. Installs and loads a package
  2. Uses a package function
  3. Lists installed packages
  4. Updates packages

Up Next

In the next lesson, you'll learn about Data Import — reading data from files.

Related Topics

Frequently Asked Questions about Packages

What is Packages in R?

Packages is a fundamental concept in R. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Packages?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Packages.

Why is Packages important in R?

Packages is essential for R development. Understanding this concept will help you write better code and solve real-world problems more effectively.