Descriptive analysis should not begin with an unexamined dataset. The data manager should first confirm that the dataset has been imported correctly, cleaned according to agreed rules, and prepared with relevant derived variables. If categorical variables are still coded as unexplained numbers, if dates are still text, if duplicate participant records are unresolved, or if key variables are missing, summary tables may mislead the study team.
Preparation begins with structure. The analyst must know the unit of observation. A
participant-level dataset has one row per participant. A visit-level dataset has one row per participant per visit. A laboratory dataset may have one row per participant per specimen, test, or result. If the unit of observation is misunderstood, denominators will be wrong. For example, counting rows in a visit-level dataset does not count participants; it counts visits. Counting rows in a laboratory dataset may count test results, not people.
The following code checks basic structure:

library(tidyverse)
library(janitor)
glimpse(prepared_data)
dim(prepared_data)
names(prepared_data)
These commands provide a quick view of the dataset. However, the data manager should
also verify the participant identifier:
prepared_data |>
summarise(
n_rows = n(),
n_participants = n_distinct(participant_id),
duplicate_participant_rows = n_rows- n_participants
)

 

If a participant-level dataset has duplicate participant rows, the summary should notproceed until the reason is understood. Duplicates may indicate repeated instruments, multiple visits, accidental duplicate records, or anincorrectjoin. Thesolutiondependsonthedatasetstructure.
Categorical variables should be reviewed before summarization:

prepared_data |>
count(site, sort = TRUE)
prepared_data |>
count(sex_label, sort = TRUE)
prepared_data |>
count(treatment_arm, sort = TRUE)

These commands check whether the categories are expected. Unexpected values such as misspelled site names, blank treatment arms, or mixed capitalization should be corrected or documented before final summaries are produced. A table that separates Female, female, and F may be technically accurate but not clinically useful.
Numeric variables should also be inspected:

prepared_data |>
summarise(
min_age = min(age_years_derived, na.rm = TRUE),
median_age = median(age_years_derived, na.rm = TRUE),
max_age = max(age_years_derived, na.rm = TRUE)
)

This simple check can reveal extreme or impossible values. A maximum age of 240 years may indicate a date problem. A minimum weight of 0 kg may indicate that a missing code was imported as a real value. Numeric summaries should therefore be interpreted as part of quality review, not merely as report content.

 

Preparation check R approach Why it matters
Confirm unit of observation Compare row count and participant count Prevents incorrect denominators
Review categories `count(variable)` Detects unexpected levels and coding issues
Review numeric ranges `min()`, `median()`, `max()` Identifies impossible or extreme values
Confirm missingness `sum(is.na(variable))` Clarifies denominators and completeness
Confirm date variables `glimpse()` and date comparisons Prevents invalid timing summaries
Review joins Count rows before and after joining Detects accidental row duplication

The strongest descriptive analysis begins with a prepared dataset whose assumptions are known. This does not mean the dataset is perfect. It means that remaining issues are visible and documented.