{"id":50,"date":"2026-03-03T09:43:02","date_gmt":"2026-03-03T09:43:02","guid":{"rendered":"https:\/\/gigz.pk\/r\/?post_type=lesson&#038;p=50"},"modified":"2026-04-01T11:59:03","modified_gmt":"2026-04-01T11:59:03","slug":"exploratory-data-analysis-eda","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/r\/lesson\/exploratory-data-analysis-eda\/","title":{"rendered":"Exploratory Data Analysis (EDA)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Exploratory Data Analysis (EDA) is the process of analyzing datasets to summarize their main characteristics, uncover patterns, detect anomalies, and test hypotheses before formal modeling. R provides many tools for both numerical and graphical exploration of data.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>1. Understanding the Dataset<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting EDA, understand the structure and contents of your data:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Load data<br>data &lt;- read.csv(\"data.csv\")# View first rows<br>head(data)# Structure and types<br>str(data)# Summary statistics<br>summary(data)<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>2. Univariate Analysis<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Univariate analysis examines one variable at a time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>a) Numerical Variables<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># Histogram<br>hist(data$Age, main=\"Age Distribution\", xlab=\"Age\", col=\"skyblue\", border=\"black\")# Boxplot<br>boxplot(data$PurchaseAmount, main=\"Purchase Amount Boxplot\", ylab=\"Amount\", col=\"lightgreen\")# Summary statistics<br>mean(data$PurchaseAmount)<br>median(data$PurchaseAmount)<br>sd(data$PurchaseAmount)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>b) Categorical Variables<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># Frequency table<br>table(data$Gender)# Proportions<br>prop.table(table(data$Gender))# Bar plot<br>barplot(table(data$Gender), main=\"Gender Distribution\", col=\"orange\")<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>3. Bivariate Analysis<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Bivariate analysis examines relationships between two variables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>a) Numerical vs Numerical<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># Scatter plot<br>plot(data$Age, data$PurchaseAmount, main=\"Age vs Purchase Amount\", xlab=\"Age\", ylab=\"Purchase Amount\", pch=19, col=\"blue\")# Correlation<br>cor(data$Age, data$PurchaseAmount)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>b) Numerical vs Categorical<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># Boxplot by category<br>boxplot(PurchaseAmount ~ Gender, data=data, main=\"Purchase by Gender\", ylab=\"Purchase Amount\", col=c(\"pink\",\"lightblue\"))<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>c) Categorical vs Categorical<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># Contingency table<br>table(data$Gender, data$ProductCategory)# Mosaic plot<br>mosaicplot(table(data$Gender, data$ProductCategory), color=TRUE, main=\"Gender vs Product Category\")<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>4. Using dplyr and ggplot2 for EDA<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><code>dplyr<\/code> and <code>ggplot2<\/code> allow more powerful and flexible data exploration.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">library(dplyr)<br>library(ggplot2)# Summary by group<br>data %&gt;%<br>  group_by(Gender) %&gt;%<br>  summarise(<br>    AvgPurchase = mean(PurchaseAmount),<br>    MaxPurchase = max(PurchaseAmount),<br>    MinPurchase = min(PurchaseAmount)<br>  )# Scatter plot with ggplot2<br>ggplot(data, aes(x=Age, y=PurchaseAmount, color=Gender)) +<br>  geom_point(size=3) +<br>  ggtitle(\"Age vs Purchase Amount by Gender\")<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>5. Detecting Outliers and Missing Values<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\"># Missing values<br>colSums(is.na(data))# Boxplot for outliers<br>boxplot(data$PurchaseAmount)<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>6. Advantages of EDA<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Understand data distributions and relationships<\/li>\n\n\n\n<li>Detect anomalies, outliers, and missing values<\/li>\n\n\n\n<li>Generate hypotheses for modeling<\/li>\n\n\n\n<li>Guide feature selection and transformation<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Exploratory Data Analysis (EDA) is a crucial first step in any data analysis project. By summarizing data, visualizing patterns, and detecting issues, EDA provides insights that inform modeling and decision-making. Tools in R, including base functions, <code>dplyr<\/code>, and <code>ggplot2<\/code>, make EDA efficient, flexible, and visually informative.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/r\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">R Programming (R Lang) > R for Data Analysis > Exploratory Data Analysis (EDA)<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1775044706666\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":27,"template":"","class_list":["post-50","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.<\/title>\n<meta name=\"description\" content=\"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.\" \/>\n<meta property=\"og:description\" content=\"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:site_name\" content=\"Analyze Deep. Visualize Better. Build with R.\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-01T11:59:03+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/r\\\/lesson\\\/exploratory-data-analysis-eda\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/\",\"name\":\"Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/r\\\/#website\"},\"datePublished\":\"2026-03-03T09:43:02+00:00\",\"dateModified\":\"2026-04-01T11:59:03+00:00\",\"description\":\"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/r\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R Programming (R Lang) > R for Data Analysis > Exploratory Data Analysis (EDA)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/r\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/r\\\/\",\"name\":\"Analyze Deep. Visualize Better. Build with R.\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/r\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.","description":"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/","og_locale":"en_US","og_type":"article","og_title":"Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.","og_description":"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.","og_url":"https:\/\/gigz.pk\/","og_site_name":"Analyze Deep. Visualize Better. Build with R.","article_modified_time":"2026-04-01T11:59:03+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/r\/lesson\/exploratory-data-analysis-eda\/","url":"https:\/\/gigz.pk\/","name":"Exploratory Data Analysis (EDA) - Analyze Deep. Visualize Better. Build with R.","isPartOf":{"@id":"https:\/\/gigz.pk\/r\/#website"},"datePublished":"2026-03-03T09:43:02+00:00","dateModified":"2026-04-01T11:59:03+00:00","description":"Learn exploratory data analysis in R with examples and visualizations. Master summary statistics, plots, and pattern detection.","breadcrumb":{"@id":"https:\/\/gigz.pk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/r\/"},{"@type":"ListItem","position":2,"name":"R Programming (R Lang) > R for Data Analysis > Exploratory Data Analysis (EDA)"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/r\/#website","url":"https:\/\/gigz.pk\/r\/","name":"Analyze Deep. Visualize Better. Build with R.","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/r\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/r\/wp-json\/wp\/v2\/lesson\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/r\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/r\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/r\/wp-json\/wp\/v2\/media?parent=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}