R Tutorial : How to summarise missing values

DataCamp · Beginner ·🛠️ AI Tools & Apps ·6y ago

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 SQL Server Tutorial: Date manipulation
SQL Server Tutorial: Date manipulation
DataCamp
2 R Tutorial: Intermediate Interactive Data Visualization with plotly in R
R Tutorial: Intermediate Interactive Data Visualization with plotly in R
DataCamp
3 R Tutorial: Adding aesthetics to represent a variable
R Tutorial: Adding aesthetics to represent a variable
DataCamp
4 R Tutorial: Moving Beyond Simple Interactivity
R Tutorial: Moving Beyond Simple Interactivity
DataCamp
5 Python Tutorial: Why use ML for marketing? Strategies and use cases
Python Tutorial: Why use ML for marketing? Strategies and use cases
DataCamp
6 Python Tutorial: Preparation for modeling
Python Tutorial: Preparation for modeling
DataCamp
7 Python Tutorial: Machine Learning modeling steps
Python Tutorial: Machine Learning modeling steps
DataCamp
8 R Tutorial: The prior model
R Tutorial: The prior model
DataCamp
9 R Tutorial: Data & the likelihood
R Tutorial: Data & the likelihood
DataCamp
10 R Tutorial: The posterior model
R Tutorial: The posterior model
DataCamp
11 R Tutorial: An Introduction to plotly
R Tutorial: An Introduction to plotly
DataCamp
12 R Tutorial: Plotting a single variable
R Tutorial: Plotting a single variable
DataCamp
13 R Tutorial: Bivariate graphics
R Tutorial: Bivariate graphics
DataCamp
14 Python Tutorial: Customer Segmentation in Python
Python Tutorial: Customer Segmentation in Python
DataCamp
15 Python Tutorial: Time cohorts
Python Tutorial: Time cohorts
DataCamp
16 Python Tutorial: Calculate cohort metrics
Python Tutorial: Calculate cohort metrics
DataCamp
17 Python Tutorial: Cohort analysis visualization
Python Tutorial: Cohort analysis visualization
DataCamp
18 R Tutorial: Building Dashboards with flexdashboard
R Tutorial: Building Dashboards with flexdashboard
DataCamp
19 R Tutorial: Anatomy of a flexdashboard
R Tutorial: Anatomy of a flexdashboard
DataCamp
20 R Tutorial: Layout basics
R Tutorial: Layout basics
DataCamp
21 R Tutorial: Advanced layouts
R Tutorial: Advanced layouts
DataCamp
22 Python Tutorial: Time Series Analysis in Python
Python Tutorial: Time Series Analysis in Python
DataCamp
23 Python Tutorial: Correlation of Two Time Series
Python Tutorial: Correlation of Two Time Series
DataCamp
24 Python Tutorial: Simple Linear Regressions
Python Tutorial: Simple Linear Regressions
DataCamp
25 Python Tutorial: Autocorrelation
Python Tutorial: Autocorrelation
DataCamp
26 R Tutorial: The gapminder dataset
R Tutorial: The gapminder dataset
DataCamp
27 R Tutorial: The filter verb
R Tutorial: The filter verb
DataCamp
28 R Tutorial: The arrange verb
R Tutorial: The arrange verb
DataCamp
29 R Tutorial: The mutate verb
R Tutorial: The mutate verb
DataCamp
30 R Tutorial: What is cluster analysis?
R Tutorial: What is cluster analysis?
DataCamp
31 R Tutorial: Distance between two observations
R Tutorial: Distance between two observations
DataCamp
32 R Tutorial: The importance of scale
R Tutorial: The importance of scale
DataCamp
33 R Tutorial: Measuring distance for categorical data
R Tutorial: Measuring distance for categorical data
DataCamp
34 Python Tutorial: Plotting multiple graphs
Python Tutorial: Plotting multiple graphs
DataCamp
35 Python Tutorial: Customizing axes
Python Tutorial: Customizing axes
DataCamp
36 Python Tutorial: Legends, annotations, & styles
Python Tutorial: Legends, annotations, & styles
DataCamp
37 Python Tutorial: Introduction to iterators
Python Tutorial: Introduction to iterators
DataCamp
38 Python Tutorial: Playing with iterators
Python Tutorial: Playing with iterators
DataCamp
39 Python Tutorial: Using iterators to load large files into memory
Python Tutorial: Using iterators to load large files into memory
DataCamp
40 SQL Tutorial: Introduction to Relational Databases in SQL
SQL Tutorial: Introduction to Relational Databases in SQL
DataCamp
41 SQL Tutorial: Tables: At the core of every database
SQL Tutorial: Tables: At the core of every database
DataCamp
42 SQL Tutorial: Update your database as the structure changes
SQL Tutorial: Update your database as the structure changes
DataCamp
43 Python Tutorial: Classification-Tree Learning
Python Tutorial: Classification-Tree Learning
DataCamp
44 Python Tutorial: Decision-Tree for Classification
Python Tutorial: Decision-Tree for Classification
DataCamp
45 Python Tutorial: Decision-Tree for Regression
Python Tutorial: Decision-Tree for Regression
DataCamp
46 Python Tutorial: Census Subject Tables
Python Tutorial: Census Subject Tables
DataCamp
47 Python Tutorial: Census Geography
Python Tutorial: Census Geography
DataCamp
48 Python Tutorial: Using the Census API
Python Tutorial: Using the Census API
DataCamp
49 R Tutorial: A/B Testing in R
R Tutorial: A/B Testing in R
DataCamp
50 R Tutorial: Baseline Conversion Rates
R Tutorial: Baseline Conversion Rates
DataCamp
51 R Tutorial: Designing an Experiment - Power Analysis
R Tutorial: Designing an Experiment - Power Analysis
DataCamp
52 R Tutorial: Introduction to qualitative data
R Tutorial: Introduction to qualitative data
DataCamp
53 R Tutorial: Understanding your qualitative variables
R Tutorial: Understanding your qualitative variables
DataCamp
54 R Tutorial: Making Better Plots
R Tutorial: Making Better Plots
DataCamp
55 SQL Tutorial: OLTP and OLAP
SQL Tutorial: OLTP and OLAP
DataCamp
56 SQL Tutorial: Storing data
SQL Tutorial: Storing data
DataCamp
57 SQL Tutorial: Database design
SQL Tutorial: Database design
DataCamp
58 Python Tutorial: Introduction to spaCy
Python Tutorial: Introduction to spaCy
DataCamp
59 Python Tutorial: Statistical Models
Python Tutorial: Statistical Models
DataCamp
60 Python Tutorial: Rule-based Matching
Python Tutorial: Rule-based Matching
DataCamp

This video tutorial teaches how to summarize missing values in R, covering basic and data frame summaries, and introducing the miss_ family of functions for detailed summaries of missingness. It provides hands-on coding experience and practical applications for data analysis.

Key Takeaways
  1. Understand what missing values are and how they operate
  2. Use n miss and n complete to count missing values
  3. Apply miss_var_summary and miss_case_summary to get detailed summaries of missingness
  4. Use miss_var_table and miss_case_table to tabulate missingness counts
  5. Apply miss_var_span and miss_var_run to analyze missingness over a span or run
  6. Use group_by to calculate missingness summaries by group
💡 The miss_ family of functions in R provides a powerful way to summarize missingness in a dataset, allowing for detailed analysis and identification of patterns of missingness.

Related Reads

Up next
What is Telematics Explained with Examples
VLR Software Training
Watch →