Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Exploratory Data Analysis with R

You're reading from   Hands-On Exploratory Data Analysis with R Become an expert in exploratory data analysis using R packages

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789804379
Length 266 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Radhika Datar Radhika Datar
Author Profile Icon Radhika Datar
Radhika Datar
Harish Garg Harish Garg
Author Profile Icon Harish Garg
Harish Garg
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: Setting Up Data Analysis Environment FREE CHAPTER
2. Setting Up Our Data Analysis Environment 3. Importing Diverse Datasets 4. Examining, Cleaning, and Filtering 5. Visualizing Data Graphically with ggplot2 6. Creating Aesthetically Pleasing Reports with knitr and R Markdown 7. Section 2: Univariate, Time Series, and Multivariate Data
8. Univariate and Control Datasets 9. Time Series Datasets 10. Multivariate Datasets 11. Section 3: Multifactor, Optimization, and Regression Data Problems
12. Multi-Factor Datasets 13. Handling Optimization and Regression Data Problems 14. Section 4: Conclusions
15. Next Steps 16. Other Books You May Enjoy

Grubbs' test and checking outliers

In R programming, an outlier is merely an observation that is unique in comparison with most of the other observations. An outlier is present because of errors in measurement in the data frame.

The following script is used to detect the particular outliers for each and every attribute:

> outlierKD <- function(dt, var) { 
+     var_name <- eval(substitute(var),eval(dt)) 
+     na1 <- sum(is.na(var_name)) 
+     m1 <- mean(var_name, na.rm = T) 
+     par(mfrow=c(2, 2), oma=c(0,0,3,0)) 
+     boxplot(var_name, main="With outliers") 
+     hist(var_name, main="With outliers", xlab=NA, ylab=NA) 
+     outlier <- boxplot.stats(var_name)$out 
+     mo <- mean(outlier) 
+     var_name <- ifelse(var_name %in% outlier, NA, var_name) 
+     boxplot(var_name, main="Without outliers") 
+     hist...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image