How to read a CSV and summarise it with dplyr
· 1 min read · Updated March 12, 2026 · beginner
r csv dplyr data-analysis
This recipe gives you a fast pattern for the common “load a file and get useful totals” task.
Recipe
library(readr)
library(dplyr)
data <- read_csv("sales.csv")
summary_table <- data %>%
group_by(region) %>%
summarise(
orders = n(),
total_revenue = sum(revenue, na.rm = TRUE),
.groups = "drop"
)
summary_table
This works well as a first pass before plotting, reporting, or exporting a cleaned result.