EDA with R: From Basic Stats to Advanced Plots
Key Takeaways
Explores healthcare data using R and Tidyverse for EDA
Full Transcript
Welcome. Let's say you're a data analyst at an important hospital and you're trying to understand all the different metrics that are associated with your patients and see how we can provide more care or actually better care. We'll be using the tidyverse library to achieve this goal. We'll be performing EDA or exploratory data analysis where we go into the data, try to understand if there's any issues and try to make a story out of it. First, let's begin with loading our library and our data set. All right, let's try to look at it. We see very common columns such as ids, age, other numeric metrics, some boolean and categorical metrics such as insurance, hospital visits, and diabetes status. All right, let's clean this variable. I'm sorry, this terminal. And let's start by calculating the mean for these numerical categories. Again, you can do mean or median. You want to make sure to add this parameter NA. RM equals true to avoid using any NAS in your analysis. Let's run this and see what happens. Beautiful. As we expected, we can see that we have created the mean values for all these categories. Age, PMI, blood pressure systolic, and blood pressure diastolic. Now, let's move on to the plot, the fun part. First, let's create a histogram using the GM histogram with a bin width of five, which is a customizable parameter. Let's run this. As you can see, we have a simple histogram but powerful. The insights we can graph from here is that the majority of our patients are in the 50 to around 60 age group. All right. Now, let's move in and add a new layer coloring. in this case by insurance type. We do this by using the fill parameter and adding the column that we're [clears throat] interested in as a color. Now, as you can see, we have the same plot, but now with extra coloring. This will allow us to see a big picture of the types of insurance that we have in our patient pool. In this case, public and private are the majority with very few having none. Now let's move into a different type of plot, a box plot. In this case, denoted by the geomeore box plot. We're also adding a new layer which is the labs parameter where we add titles. In this case, a nice overarching title BM BMI by gender as well as titles for the X and Y axis. Turn this As you can see, this bar is immediate. We also can see any outliers from this as well as our titles for our plots. Beautiful. This is great. All right. Now, we're going into a different type of plot, a scatter plot or a GM underscore plot. We also have this alpha parameter, which is the thickness of the points. Let's plot BMI versus blood pressure systolic and see what it looks like. All right. In this case, we can see a scattering, a lot of scattering, not much of a trend, but at least we can visualize everything. This will allow us to understand whether we have patients with really high blood pressure. In this case, for example, this one, very low BMI, but really high blood pressure. Might be worth looking into this patient. Now let's see as we're trying to understand the data we're trying to put numerical values to it. In this case correlation let's see if we can plot the correlation value for BMI versus blood pressure systolic which we plotted in the previous plot. Remember to use use equals complete.obs to only use complete observations or in other words entries that have no NAS. Let's clean the terminal so it's much cleaner. And this, as you can see, we have a correlation of nearly 1%. Quite low. It makes sense. A lot of the data was really scattered. But remember, you can do this with any numerical combination, so it's worth investigating. Now, let's circle back to the box plot and see if we can combine what we learned where we're adding a plot and then using the fill parameter to add some coloring to it. In this case, the insurance type versus the number of hospital visits. All right, let's see how this looks. Beautiful. Just as we expected, a box plot with coloring. This is fantastic. Remember all these plots are customizable. So it's at your disposal to try to understand what the best combination of color and viewing will attract your audience attention. Now let's circle back and try to understand what we did today and understand that we did a lot of parts of EDA starting with analyzing general statistics and then moving on to visualizations and customization of these visualizations where we learned about histogram plots, box plots and scatter plots. We also learned how to calcate a correlation which is a very powerful statistic. And there you have it. We learned a lot but you're doing great. So keep going and happy coding.
Original Description
Learn how to analyze healthcare data using R and Tidyverse. Follow along as we explore patient data through statistics and visualizations, perfect for healthcare analysts and data science beginners.
🕐 Timestamps:
0:00 - Introduction & Setup
0:32 - Loading Healthcare Dataset
1:01 - Basic Statistical Analysis
1:31 - Creating Histograms
2:02 - Insurance Type Analysis
2:32 - Box Plots & Demographics
3:19 - Scatter Plots
4:04 - Correlation Analysis
4:48 - Advanced Visualizations
5:24 - Summary & Best Practices
🎓 This is a course preview of the *Microsoft R Programming for Everyone Professional Certificate* on Coursera. With the complete program, you'll:
• Learn to write efficient R code
• Collaborate through GitHub
• Analyze complex datasets
• Use AI tools to enhance productivity
• No prior programming experience needed
• Build a professional portfolio of hands-on projects using real datasets in a Microsoft development environment
Enroll now to access the complete 5-course program 👇
https://bit.ly/4nNMkGi
#HealthcareAnalytics #DataScience #RProgramming
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Coursera · Coursera · 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
Principles of Obesity Economics with Professor Kevin Frick
Coursera
Introduction to the U.S. Food System: Perspectives from Public Health by John Hopkins University
Coursera
E-learning and Digital Cultures
Coursera
Equine Nutrition with Jo-Anne Murray
Coursera
Coursera Meetup BBQ
Coursera
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
Nutrition for Health Promotion and Disease Prevention with Katie Clark
Coursera
Information Security and Risk Management in Context with Dr. Barbara Endicott-Popovsky
Coursera
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
Writing in the Sciences with Kristin Sainani
Coursera
Economic Issues, Food, and You with Jennifer Clark
Coursera
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
Useful Genetics with Professor Rosie Redfield
Coursera
A History of the World since 1300!!!! with Jeremy Adelman
Coursera
Microeconomics with Richard McKenzie
Coursera
Discrete Optimization with Professor Pascal Van Hentenryck
Coursera
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
Science from Superheroes to Global Warming with Michael Dennin
Coursera
Introduction to Digital Sound Design with Steve Everett by Emory University
Coursera
Women and the Civil Rights Movement with Dr. Elsa Barkley Brown
Coursera
Galaxies and Cosmology with S. George Djorgovski
Coursera
Science, Technology, and Society in China I, II, and III: Basic Concepts with Naubahar Sharif
Coursera
Introduction to Pharmacy with Kenneth M. Hale, R.Ph., Ph.D.
Coursera
AIDS with Kimberley Sessions Hagen, EdD
Coursera
Health Informatics in the Cloud with Mark Braunstein
Coursera
Songwriting with Pat Pattison by Berklee College of Music
Coursera
Software Defined Networking with Dr. Nick Feamster
Coursera
Epigenetic Control of Gene Expression with Dr Marnie Blewitt
Coursera
Guitar for Beginners - Introduction to Guitar with Thaddeus Hogarth by Berklee College of Music
Coursera
Organizational Analysis with Daniel McFarland
Coursera
Scientific Computing with J. Nathan Kutz
Coursera
Jazz Improvisation - Introduction to Improvisation with Gary Burton by Berklee College of Music
Coursera
Principles of Economics for Scientists with Antonio Rangel
Coursera
Introduction to Music Production with Loudon Stearns by Berklee College of Music
Coursera
Principles of Public Health with Zuzana Bic
Coursera
The Science of Gastronomy with King Chow, Lam Lung Yeung by HKUST
Coursera
The Language of Hollywood: Storytelling, Sound, and Color with Scott Higgins by Wesleyan University
Coursera
Nutrition and Physical Activity for Health with John M. Jakicic, Ph.D., and Amy D. Rickman,...
Coursera
Nutrition, Health, and Lifestyle: Issues and Insights with Jamie Pope, MS, RD, L
Coursera
Survey of Music Technology with Jason Freeman by Georgia Institute of Technology
Coursera
Exercise Physiology: Understanding the Athlete Within with Mark Hargreaves
Coursera
Canine Theriogenology for Dog Enthusiasts with Margaret V. Root
Coursera
Web Intelligence and Big Data with Gautam Shroff
Coursera
Critical Perspectives on Management with Rolf Strom-Olsen
Coursera
El ABC del emprendimiento esbelto with Sergio Ortiz Valdes
Coursera
Interprofessional Healthcare Informatics with Karen Monsen
Coursera
Creativity, Innovation, and Change with Jack V. Matson, Darrell Velegol and Kath
Coursera
Innovacion educativa con recursos abiertos with Maria Soledad Ramirez Montoya an
Coursera
Inspiring Leadership through Emotional Intelligence with Richard Boyatzis
Coursera
Matematicas y movimiento with
Coursera
Sustainability of Food Systems: A Global Life Cycle Perspective with Jason Hill
Coursera
Latin American Culture with Enrique Tames
Coursera
Latin American Culture' with undefined
Coursera
Computer Security with Dan Boneh
Coursera
Introduction to Art: Concepts & Techniques
Coursera
Programmed cell death
Coursera
El ABC del emprendimiento esbelto
Coursera
Understanding economic policymaking
Coursera
History of Rock, Part 1 by University of Rochester
Coursera
Pensamiento Cientifico
Coursera
More on: ML Maths Basics
View skill →Related Reads
📰
📰
📰
📰
AI Inventory Rebalancing: The Smarter Way to Eliminate Stockouts and Excess Inventory
Medium · AI
I kept losing the things AI made for me, so I built an iPhone library for them
Dev.to AI
The Real App-Building Kit for Non-Technical Founders: Trustworthy AI-Powered Development
Dev.to AI
“5 AI Tools That Can Save You Hours Every Week”
Medium · AI
Chapters (10)
Introduction & Setup
0:32
Loading Healthcare Dataset
1:01
Basic Statistical Analysis
1:31
Creating Histograms
2:02
Insurance Type Analysis
2:32
Box Plots & Demographics
3:19
Scatter Plots
4:04
Correlation Analysis
4:48
Advanced Visualizations
5:24
Summary & Best Practices
🎓
Tutor Explanation
DeepCamp AI