Detecting and removing outliers
Outliers are usually dangerous values for data science activities, since they produce heavy distortions within models and algorithms.
Their detection and exclusion is, therefore, a really crucial task.
This recipe will show you how to easily perform this task.
We will compute the I and IV quartiles of a given population and detect values that far from these fixed limits.
You should note that this recipe is feasible only for univariate quantitative population, while different kind of data will require you to use other outlier-detection methods.
How to do it...
- Compute the quantiles using the
quantiles <- quantile(tidy_gdp_complete$gdp, probs = c(.25, .75))
- Compute the range value using the