<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/explore-your-dataset-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.littlemissdata.com/blog/simple-eda"> Little Miss Data</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>As person who works with data, one of the most exciting activities is to explore a fresh new dataset. You’re looking to understand what variables you have, how many records the data set contains, how many missing values, what is the variable structure, what are the variable relationships and more. While there is a ton you can do to get up and running, I want to show you a few simple commands to help you get a fast overview of the data set you are working with. </p>
<p> <img data-image-dimensions="640x300" data-image-focal-point="0.5,0.5" src="https://i2.wp.com/static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfc2fb4d7a9c04ee50b7aa/1541391160702/dataExplorerGifLg.gif?w=456&ssl=1" alt="dataExplorerGifLg.gif" data-load="false" data-type="image" data-image-id="5bdfc2fb4d7a9c04ee50b7aa" data-recalc-dims="1" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfc2fb4d7a9c04ee50b7aa/1541391160702/dataExplorerGifLg.gif"></p>
<p> </p>
<h1>Simple Exploratory Data Analysis (EDA)</h1>
<h2>Download the data set</h2>
<p>Before we get rolling with the EDA, we want to download our data set. For this example, we are going to use the dataset produced by <a rel="nofollow" href="https://www.littlemissdata.com/blog/steam-data-art2" target="_blank">my recent science, technology, art and math (STEAM) project.</a></p>
<pre><code>#Load the readr library to bring in the dataset
library(readr)

#Download the data set
df= read_csv('https://raw.githubusercontent.com/lgellis/STEM/master/DATA-ART-1/Data/FinalData.csv', col_names = TRUE)</code></pre>
<p>Now that we have the data set all loaded, and it’s time to run some very simple commands to preview the data set and it’s structure. </p>
<p> <img data-image-dimensions="1636x568" data-image-focal-point="0.5,0.5" src="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbe1940ec9a449dbf331e/1541389853240/?format=1000w" data-load="false" data-type="image" data-image-id="5bdfbe1940ec9a449dbf331e" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbe1940ec9a449dbf331e/1541389853240/"></p>
<h2>Head</h2>
<p>To begin, we are going to run the head function, which allows us to see the first 6 rows by default. We are going to override the default and ask to preview the first 10 rows. </p>
<pre><code>head(df, 10)</code></pre>
<p> </p>
<p> <img data-image-dimensions="1610x672" data-image-focal-point="0.5,0.5" src="https://i0.wp.com/static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5be0548b4ae2373920f49a31/1541428372132/glimpse%28%29.png?w=456&ssl=1" alt="glimpse().png" data-load="false" data-type="image" data-image-id="5be0548b4ae2373920f49a31" data-recalc-dims="1" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5be0548b4ae2373920f49a31/1541428372132/glimpse%28%29.png"></p>
<h2>dim and Glimpse</h2>
<p>Next, we will run the dim function which displays the dimensions of the table. The output takes the form of row, column. </p>
<p>And then we run the glimpse function from the dplyr package. This will display a vertical preview of the dataset. It allows us to easily preview data type and sample data.</p>
<pre><code>dim(df)

#Displays the type and a preview of all columns as a row so that it's very easy to take in.

library(dplyr)
glimpse(df)</code></pre>
<p> </p>
<p> <img data-image-dimensions="1530x718" data-image-focal-point="0.5,0.5" src="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbf57aa4a999c65a758d1/1541390171491/?format=1000w" data-load="false" data-type="image" data-image-id="5bdfbf57aa4a999c65a758d1" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbf57aa4a999c65a758d1/1541390171491/"></p>
<h2>Summary</h2>
<p>We then run the summary function to show each column, it’s data type and a few other attributes which are especially useful for numeric attributes. We can see that for all the numeric attributes, it also displays min, 1st quartile, median, mean, 3rd quartile and max values. </p>
<pre><code>summary(df)</code></pre>
<p> </p>
<p> <img data-image-dimensions="1340x1034" data-image-focal-point="0.5,0.5" src="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbee421c67cf1f97691f0/1541390056718/?format=1000w" data-load="false" data-type="image" data-image-id="5bdfbee421c67cf1f97691f0" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbee421c67cf1f97691f0/1541390056718/"></p>
<h2>Skim</h2>
<p>Next we run the skim function from the <a rel="nofollow" href="https://www.rdocumentation.org/packages/skimr/versions/1.0.3/topics/skim?tap_a=5644-dce66f&tap_s=10907-287229" target="_blank">skimr</a> package. The skim function is a good addition to the summary function. It displays most of the numerical attributes from summary, but it also displays missing values, more quantile information and an inline histogram for each variable!</p>
<pre><code>library(skimr)
skim(df)</code></pre>
<p> </p>
<h2>create_report in DataExplorer</h2>
<p>And finally the pièce de résistance, the main attraction and the reason I wrote this blog; the create_report function in the DataExplorer package. This awesome one line function will pull a full data profile of your data frame. It will produce an html file with the basic statistics, structure, missing data, distribution visualizations, correlation matrix and principal component analysis for your data frame! I recently learned about this function in a <a rel="nofollow" href="https://www.eventbrite.com/e/modern-r-for-data-science-workshop-w-steph-locke-tickets-50536282381#" target="_blank">workshop given by Stephe Locke</a> hosted by <a rel="nofollow" href="https://www.meetup.com/rladies-austin/" target="_blank">R Ladies Austin</a>. This function is a game changer!</p>
<pre><code>library(DataExplorer)
DataExplorer::create_report(df)</code></pre>
<p> <img data-image-dimensions="1754x1220" data-image-focal-point="0.5,0.5" src="https://i1.wp.com/static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbfc1575d1f0d19362cb5/1541390282512/DataExplorer.png?w=456&ssl=1" alt="DataExplorer.png" data-load="false" data-type="image" data-image-id="5bdfbfc1575d1f0d19362cb5" data-recalc-dims="1" data-image="https://static1.squarespace.com/static/58eef8846a4963e429687a4d/t/5bdfbfc1575d1f0d19362cb5/1541390282512/DataExplorer.png"></p>
<h2>THANK YOU</h2>
<p>Thanks for reading along while we explored some simple EDA in R.  Please share your thoughts and creations with me on <a rel="nofollow" href="https://twitter.com/LittleMissData" target="_blank">twitter</a>. </p>
<p>Note that the full code is available on my <a rel="nofollow" href="https://github.com/lgellis/MiscTutorial/tree/master/Austin" target="_blank"> </a><a rel="nofollow" href="https://github.com/lgellis/MiscTutorial/blob/master/simple_eda/exploreData.Rmd" target="_blank">github repo. </a> If you have trouble downloading the file from github, go to the <a rel="nofollow" href="https://github.com/lgellis/MiscTutorial" target="_blank">main page of the repo</a> and select “Clone or Download” and then “Download Zip”.</p>
<p data-rte-preserve-empty="true">
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.littlemissdata.com/blog/simple-eda"> Little Miss Data</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/qzx0xWZ2Zkk" height="1"></a></div>