r summary statistics table

R Summary Statistics Table: Quick Guide with Examples

By Olivia Moore
AD

When you finish importing and cleaning a dataset in R, the next question is often painfully practical: what does this data actually look like? An R summary statistics table answers that question by condensing dozens or thousands of rows into a compact set of counts, means, medians, standard deviations, quantiles, and missing-value tallies. Whether you are checking assumptions before a regression model or preparing a Table 1 for a report, a well-built summary table turns raw data into something a human can read in seconds.

This guide walks through the most useful ways to create an R summary statistics table, from quick one-line commands to polished, publication-ready outputs. You will see how base R functions like summary() and sapply() compare with tidyverse workflows, when specialized packages such as skimr, gtsummary, and tableone save hours, and how to export tables to HTML, Word, or PDF without losing your formatting.

Building Summary Statistics Tables with Base R and the Tidyverse

Base R remains the fastest starting point. Calling summary() on a data frame returns six-number summaries for numeric columns and frequency counts for factors or characters. It is an excellent first look because it requires no packages and immediately reveals range problems, skew, and unexpected categorical levels.

AD
{stargazer} package for beautiful LaTeX tables from R statistical models output | R-bloggers
{stargazer} package for beautiful LaTeX tables from R statistical models output | R-bloggers
data.table vs. data.frame in R (Example) | Comparing Syntax & Efficiency
data.table vs. data.frame in R (Example) | Comparing Syntax & Efficiency
Draw Stacked Bars within Grouped Barplot (R Example) | ggplot2 Barchart
Draw Stacked Bars within Grouped Barplot (R Example) | ggplot2 Barchart

The tidyverse, especially dplyr, gives you more control over which statistics appear and how they are grouped. Instead of accepting default output, you can specify exactly the mean, standard deviation, median, interquartile range, sample size, and missing count for every variable. That flexibility is why most modern R summary statistics table workflows combine dplyr for calculation with gt, flextable, or knitr for display.

Using summary() and sapply() for Quick Descriptive Statistics

The summary() function is ideal for exploratory work. For a numeric vector it reports the minimum, first quartile, median, mean, third quartile, and maximum. For a factor it reports counts for each level. When applied to a data frame, it repeats this for every column, making it easy to spot columns with strange ranges or many missing values.

How to derive summary statistics using PostgreSQL | Towards Data Science
How to derive summary statistics using PostgreSQL | Towards Data Science
The Normal Curve | Boundless Statistics |
The Normal Curve | Boundless Statistics |
Statistics Project, Descriptive Statistics, Statistics Cheat Sheet, Statistics Notes, College Notes Organization, Nursing Student Tips, College Organization, Computer Coding, Research Writing
Statistics Project, Descriptive Statistics, Statistics Cheat Sheet, Statistics Notes, College Notes Organization, Nursing Student Tips, College Organization, Computer Coding, Research Writing

To add standard deviation, sample size, or missing counts, sapply() or apply() can return a custom matrix. For example, sapply(df, function(x) c(mean = mean(x, na.rm = TRUE), sd = sd(x, na.rm = TRUE), n = sum(!is.na(x)))) produces a tidy matrix that can be converted into a data frame. Add table() for categorical variables and you have a fast, dependency-free R summary statistics table for initial analysis.

Creating Custom Summaries with dplyr and data.table

dplyr's group_by() and summarise() functions are the workhorses of grouped descriptive statistics. You can write grouped summaries such as average revenue by region, median wait time by hospital, or count of missing values by treatment arm. The across() helper applies the same statistics to multiple numeric columns, reducing repetitive code and keeping the output consistent.

AD

data.table offers a concise and extremely fast alternative for large datasets. Syntax like DT[, .(mean_value = mean(value, na.rm = TRUE), sd_value = sd(value, na.rm = TRUE), .N), by = group] returns a summary table in milliseconds. Both dplyr and data.table produce rectangular results that can be passed directly to gt, kableExtra, or flextable for final formatting.

Grouped Barplot With Error Bars in R | Towards Data Science
Grouped Barplot With Error Bars in R | Towards Data Science
a poster with many different types of data and diagrams on it's sides, including graphs
a poster with many different types of data and diagrams on it's sides, including graphs
Multinomial Logistic Regression in R | Towards Data Science
Multinomial Logistic Regression in R | Towards Data Science
Presenting Technical Data? Do it in Viewer-Friendly Ways
Presenting Technical Data? Do it in Viewer-Friendly Ways
How to make Ridiculous Tables in R (from Excel) | R-bloggers
How to make Ridiculous Tables in R (from Excel) | R-bloggers
Working with Survey Data - Clean and Visualize Likert Scale Questions in R | Towards Data Science
Working with Survey Data - Clean and Visualize Likert Scale Questions in R | Towards Data Science

Specialized R Packages for Publication-Ready Summary Statistics Tables

Once your numbers are correct, presentation becomes the next challenge. A table for a journal article, clinical report, or executive dashboard must align decimals, label variables clearly, handle missing data gracefully, and often include group comparisons. Specialized R packages are designed for exactly these tasks.

The best choice depends on your audience. skimr and summarytools excel at rapid data profiling. gtsummary and tableone dominate clinical and epidemiological reporting. janitor simplifies cross-tabulations, while gt and flextable turn any data frame into a beautifully formatted table for HTML, Word, or PDF.

AD

skimr and summarytools for Fast Data Profiling

skimr::skim(df) is one of the fastest ways to inspect an entire data frame. It reports variable types, missing values, complete rates, numeric summaries, and even tiny histograms in the console. This makes it invaluable for data quality checks before you build a formal R summary statistics table.

Lexicon-Based Sentiment Analysis Using R | Towards Data Science
Lexicon-Based Sentiment Analysis Using R | Towards Data Science
Simple Explanation of Statsmodel Linear Regression Model Summary | Towards Data Science
Simple Explanation of Statsmodel Linear Regression Model Summary | Towards Data Science
Top 7 Packages for Making Beautiful Tables in R | Towards Data Science
Top 7 Packages for Making Beautiful Tables in R | Towards Data Science
Tottenham Hotspur Squad Minutes Played Season 2026-27
Tottenham Hotspur Squad Minutes Played Season 2026-27

summarytools::dfSummary(df) goes a step further by producing an HTML profile with frequency tables and bar charts for categorical variables, plus distribution statistics for numeric ones. summarytools::descr() provides a clean numeric summary table, and both functions can be rendered inside R Markdown or Quarto documents for reproducible reporting.

gtsummary and tableone for Clinical and Grouped Tables

gtsummary::tbl_summary() creates elegant summary tables with a single function call. Add by = treatment_group to compare groups, then add_p() for hypothesis tests, add_n() for sample sizes, and add_stat_label() for clean labels. The result is a publication-ready R summary statistics table that can be exported to Word, HTML, PDF, or LaTeX.

AD

tableone::CreateTableOne() is a classic choice for medical research. It builds the familiar Table 1 with continuous variables as mean ± SD or median [IQR] and categorical variables as counts and percentages. With strata = treatment, it automatically compares groups and can report standardized mean differences. Exporting the printed table to CSV or using kable() makes it easy to include in manuscripts.

Choosing the right method comes down to the job at hand. Use summary() and sapply() for a quick pulse check, dplyr or data.table when you need grouped statistics, skimr for profiling, and gtsummary or tableone when the table must impress reviewers. Start with the simplest tool that answers your question, then upgrade the presentation only when your audience needs it. A clean, accurate R summary statistics table is not just a reporting chore; it is one of the most effective ways to build trust in your analysis, and the next dataset you open is the perfect place to practice.

AD