Next →

Output:


      

Plots:

Working with R Packages

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.

Installing and Loading Packages

# Install the dplyr package
install.packages("dplyr")

# Load the package into your session
library(dplyr)

Using Package Functions

# 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.