R Tutorial : How to summarise missing values
Key Takeaways
The video tutorial demonstrates how to summarize missing values in R using the DataCamp course, covering basic and data frame summaries, and introducing the miss_ family of functions for detailed summaries of missingness.
Full Transcript
now that you understand what missing values are how to count them and how they operate let's scale these up to more detailed summaries of missingness we need to summarize missing data to identify variables cases or patterns of missingness as these can bias our data analysis there are two main summaries basic and data frame summaries basic summaries are returned a single number like the number of missing or complete values using n miss or n complete however you will need more detailed missing the summaries to help you on your journey through a data analysis this lesson introduces you to missing data summaries gnarnia provides a family functions all starting with miss underscore which each provide different summaries of missingness and return a data frame this allows us to see features they can be difficult to articulate or time-consuming to calculate for example ms VAR summary and miss case summary returned the number and percentage of missings in each variable or case these summaries work with deep layers group by so you can fluidly explore missingness by age group use miss VAR summary to summarize the number of missing x' in each variable this returns a data frame where each row is a variable it also includes summaries of the number and percentage of missings for each variable in the data set and is sorted by the number of missing x' for example ozone has 37 missing values and is about 24.2% missing similar to miss var summary miss case summary returns a summary data frame where each case represents a row in the data set here case five the fifth row on the data set has two missing values which means 33% of that case is missing tabulation of missingness counts the number of times there are 0 1 2 3 and so on missings they're very useful compact summaries that reveal interesting structure miss var table returns a data frame with the number of missing x' in a variable and the number and percentage of variables affected for example there are 4 variables with no missings detected which corresponds to 66.7% of the variables and there was one variable with 7 missings and one variable with 37 missings similarly miss case table returns the same information but for cases we can also look at missing this over a given span or run for a given variable using miss VAR span and miss var run these can be really useful for data with many regular measurements like time series data miss VAR span calculates the number of missings in a variable for a repeating span this is really useful in time series data to look for weekly that is seven-day patterns of missingness miss var span returns a data frame with columns span counter which identifies the span the first the second and so on and also includes the number and proportion of missing and complete values for example in span 10 there are 432 missings and 3568 complete values note also that an miss plus n complete equals the span here this is a span of 4,000 and out of these 4,000 values in this span 0.108 are missing and point 8 down to our complete given by prop miss and prop complete miss VAR run returns the runs or streaks of missingness this is useful to try and find unusual patterns of missingness it returns the length of the run of complete and missing data this is particularly useful for finding repeating patterns of missingness sometimes you are interested in missing us for groups in the data each missing this summary function can actually be calculated by group using group by from d player for example we can look at the missing this by month in the air quality data set here we see that month 5 for ozone has 5 missings but month six rows own has 21 missings now
Original Description
Want to learn more? Take the full course at https://learn.datacamp.com/courses/dealing-with-missing-data-in-r at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.
---
Now that you understand what missing values are, how to count them, and how they operate, let's scale these up to more detailed summaries of missingness.
We need to summarise missing data to identify variables, cases, or patterns of missingness, as these can bias our data analysis.
There are two main summaries: basic, and dataframe summaries.
Basic summaries return a single number, like the number of missing or complete values using n_miss or n_complete.
However, you will need more detailed missingness summaries to help you on your journey through a data analysis.
This lesson introduces you to missing data summaries.
naniar provides a family of functions all starting with miss_., which each provide different summaries of missingness, and return a dataframe.
This allows us to see features that can be difficult to articulate, or time consuming to calculate.
For example, miss_var_summary and miss_case_summary return the number and percentage of missings in each variable or case.
These summaries work with dplyr''s group_by, so you can fluidly explore missingness by each groups.
Use miss_var_summary to summarise the number of missings in each variable.
This returns a dataframe where each row is a variable. It also includes summaries of the number and percentage of missings for each variable in the dataset, and is sorted by the number of missings.
For example, Ozone has 37 missing values, and is about 24.2 percent missing.
Similar to miss_var_summary, miss_case_summary returns a summary dataframe, where each case represents a dataset row number.
Here, case 5 - the fifth row in the dataset - has 2 missing values, which means 33% of that case is missing.
Tabulation of missingness counts the number of times there are 0, 1, 2, 3, and so on,
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from DataCamp · DataCamp · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
SQL Server Tutorial: Date manipulation
DataCamp
R Tutorial: Intermediate Interactive Data Visualization with plotly in R
DataCamp
R Tutorial: Adding aesthetics to represent a variable
DataCamp
R Tutorial: Moving Beyond Simple Interactivity
DataCamp
Python Tutorial: Why use ML for marketing? Strategies and use cases
DataCamp
Python Tutorial: Preparation for modeling
DataCamp
Python Tutorial: Machine Learning modeling steps
DataCamp
R Tutorial: The prior model
DataCamp
R Tutorial: Data & the likelihood
DataCamp
R Tutorial: The posterior model
DataCamp
R Tutorial: An Introduction to plotly
DataCamp
R Tutorial: Plotting a single variable
DataCamp
R Tutorial: Bivariate graphics
DataCamp
Python Tutorial: Customer Segmentation in Python
DataCamp
Python Tutorial: Time cohorts
DataCamp
Python Tutorial: Calculate cohort metrics
DataCamp
Python Tutorial: Cohort analysis visualization
DataCamp
R Tutorial: Building Dashboards with flexdashboard
DataCamp
R Tutorial: Anatomy of a flexdashboard
DataCamp
R Tutorial: Layout basics
DataCamp
R Tutorial: Advanced layouts
DataCamp
Python Tutorial: Time Series Analysis in Python
DataCamp
Python Tutorial: Correlation of Two Time Series
DataCamp
Python Tutorial: Simple Linear Regressions
DataCamp
Python Tutorial: Autocorrelation
DataCamp
R Tutorial: The gapminder dataset
DataCamp
R Tutorial: The filter verb
DataCamp
R Tutorial: The arrange verb
DataCamp
R Tutorial: The mutate verb
DataCamp
R Tutorial: What is cluster analysis?
DataCamp
R Tutorial: Distance between two observations
DataCamp
R Tutorial: The importance of scale
DataCamp
R Tutorial: Measuring distance for categorical data
DataCamp
Python Tutorial: Plotting multiple graphs
DataCamp
Python Tutorial: Customizing axes
DataCamp
Python Tutorial: Legends, annotations, & styles
DataCamp
Python Tutorial: Introduction to iterators
DataCamp
Python Tutorial: Playing with iterators
DataCamp
Python Tutorial: Using iterators to load large files into memory
DataCamp
SQL Tutorial: Introduction to Relational Databases in SQL
DataCamp
SQL Tutorial: Tables: At the core of every database
DataCamp
SQL Tutorial: Update your database as the structure changes
DataCamp
Python Tutorial: Classification-Tree Learning
DataCamp
Python Tutorial: Decision-Tree for Classification
DataCamp
Python Tutorial: Decision-Tree for Regression
DataCamp
Python Tutorial: Census Subject Tables
DataCamp
Python Tutorial: Census Geography
DataCamp
Python Tutorial: Using the Census API
DataCamp
R Tutorial: A/B Testing in R
DataCamp
R Tutorial: Baseline Conversion Rates
DataCamp
R Tutorial: Designing an Experiment - Power Analysis
DataCamp
R Tutorial: Introduction to qualitative data
DataCamp
R Tutorial: Understanding your qualitative variables
DataCamp
R Tutorial: Making Better Plots
DataCamp
SQL Tutorial: OLTP and OLAP
DataCamp
SQL Tutorial: Storing data
DataCamp
SQL Tutorial: Database design
DataCamp
Python Tutorial: Introduction to spaCy
DataCamp
Python Tutorial: Statistical Models
DataCamp
Python Tutorial: Rule-based Matching
DataCamp
More on: Data Literacy
View skill →Related Reads
📰
📰
📰
📰
A Gen X entrepreneur closing their laptop at the end of a productive, shortened workday, ready to…
Medium · AI
Earning Technical Certifications in 5 Steps with AI Tools
Dev.to AI
10 AI Tools That Can Save You Hours Every Week
Medium · AI
I Built Python Tools for Small Problems — They Ended Up Saving Me Hours
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI