R Packages

R BasicsPackagesFree Lesson

Advertisement

Introduction

R packages are collections of functions, data, and documentation that extend R's capabilities. There are over 18,000 packages available.

Installing Packages

# Install from CRAN
install.packages("tidyverse")
install.packages(c("ggplot2", "dplyr", "tidyr"))

# Install from GitHub
devtools::install_github("author/package")

# Install from Bioconductor
BiocManager::install("DESeq2")

Loading Packages

# Using library()
library(tidyverse)
library(ggplot2)

# Using require()
require(dplyr)

Package Functions

# List loaded packages
search()

# Check installed packages
installed.packages()

# Update packages
update.packages()

# Remove package
remove.packages("package_name")

Using Package Functions

# With namespace
dplyr::filter(df, condition)
ggplot2::ggplot(df, aes(x, y))

# After loading
library(dplyr)
filter(df, condition)

Finding Help

# Package help
help(package = "ggplot2")

# Function help
?ggplot
??geom_point  # Search

Summary

Packages extend R's functionality. Learn to install, load, and use packages effectively.

Advertisement

Need Expert R Programming Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement