R’s functionality can be extended using packages—collections of functions, data sets, and documentation. You can install, load, and use packages to simplify tasks like data manipulation, visualization, or modeling.
# Install the dplyr package
install.packages("dplyr")
# Load the package into your session
library(dplyr)
# Using dplyr to filter data
data <- data.frame(name = c("Alice", "Bob", "Charlie"), age = c(25, 30, 22))
filtered_data <- filter(data, age > 24)
filtered_data
Packages allow you to leverage pre-built tools and focus on analyzing your data efficiently.