Module lessons (2/2)
Data Exploration, NA and Aggregations
Calculate mean, median, sd, quantiles with na.rm = TRUE and summarize groups with tapply() and aggregate().
What you'll learn in this lesson
- Calculate position indices (
mean,median) and dispersion (sd,var,range,IQR) choosing between mean and median. - Defuse missing value propagation via
na.rm = TRUEandna.omit(). - Filter tables readably with
subset()and summarize metrics by group withaggregate()andtapply(). - Interpret the full output of
summary()on numeric vectors and data frames.
Overview
Exploratory Data Analysis (EDA) answers three questions before you even build a graph or model: which values are typical, how much the observations vary, and whether there is anomalous or missing data (NA).
The arithmetic mean (mean) is highly affected by extreme values (outliers), while the median (median) represents the central value at 50% and is robust to asymmetries. If there is even just one NA, all of these functions return NA until you explicitly pass na.rm = TRUE.
Sections covered in this lesson
- 1Location, dispersion and
na.rm = TRUE - 2Filter and group in Base R:
subset(),tapply()andaggregate() - 3Test yourself: guided exercises
- 4Concept check
Unlock "Data Exploration, NA and Aggregations" and the full Course R curriculum
Calculate mean, median, sd, quantiles with na.rm = TRUE and summarize groups with tapply() and aggregate().
Unlock all 7 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course R plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.