[null, {"document_url": "https://blog.datascienceheroes.com/exploratory-data-analysis-in-r-intro/", "unformatted_src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/frequency_analysis_2.png", "src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/frequency_analysis_2.png", "formatted_filename": "frequency analysis", "alt_text": "Frequency analysis"}, {"document_url": "https://blog.datascienceheroes.com/exploratory-data-analysis-in-r-intro/", "unformatted_src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/frequency_analysis_1.png", "src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/frequency_analysis_1.png", "formatted_filename": "frequency analysis", "alt_text": "Frequency analysis"}, null, {"document_url": "https://blog.datascienceheroes.com/exploratory-data-analysis-in-r-intro/", "unformatted_src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/histograms_3.png", "src": "https://s3.amazonaws.com/datascienceheroes.com/img/blog/histograms_3.png", "formatted_filename": "histograms", "alt_text": "Histograms"}, null]

tl;dr: Exploratory data analysis (EDA) the very first step in a data project. We will create a code-template to achieve this with one function.


EDA consists of univariate (1-variable) and bivariate (2-variables) analysis.
In this post we will review some functions that lead us to the analysis of the first case.

Covering some key points in a basic EDA:

Type of analysis results

They can be two: informative or operative.

Informative - For example plots, or any long variable summary. We cannot filter data from it, but give us a lot of information at once. Most used on the EDA stage.

Operative - The results can be used to take an action directly on the data workflow (for example, selecting any variables whose percentage of missing values are below 20%). Most used in the Data Preparation stage.


Uncoment in case you don't have any of these libraries:

A newer version of funModeling has been released on Ago-1, please update ;)

Now load the needed libraries...

tl;dr (code)

Run all the functions in this post in one-shot with the following function:

Replace data with your data, and that's it!:


Creating the data for this example

Using the heart_disease data (from funModeling package). We will take only 4 variables for legibility.

Step 1 - First approach to data

Number of observations (rows) and variables, and a head of the first cases.

Getting the metrics about data types, zeros, infinite numbers, and missing values:

df_status returns a table, so it is easy to keep with variables that match certain conditions like:
+ Having at least 80% of non-NA values (p_na < 20)
+ Having less than 50 unique values (unique <= 50)


[🔎 Read more here.]

Step 2 - Analyzing categorical variables

freq function runs for all factor or character variables automatically: 
Step 3 - Analyzing numerical variables

We will see: plot_num and profiling_num. Both run automatically for all numerical/integer variables: Export the plot to jpeg: plot_num(data, path_out = ".")




profiling_num runs for all numerical/integer variables automatically:



Step 4 - Analyzing numerical and categorical at the same time

describe from Hmisc package.

Really useful to have a quick picture for all the variables. But is not as operative as freq and profiling_num when we want to use its results to change our data workflow.



PS: Does anyone remember the function that creates a single-page with a data summary? Wanted to mention here...

That's all by now! :)





tl;dr: A list of useful resources aimed to self-publish a book on Amazon using Bookdown.

Este tutorial tiene como propósito hacer el set-up inicial para empezar a desarrollar modelos machine learning en increíble lenguaje R.

Exploratory Data Analysis in R (introduction)