R Summary Statistics Table: Quick Guide with Examples
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.
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.
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.
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.
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.
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.
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.
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.