Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Machine Learning with R Quick Start Guide

You're reading from  Machine Learning with R Quick Start Guide

Product type Book
Published in Mar 2019
Publisher Packt
ISBN-13 9781838644338
Pages 250 pages
Edition 1st Edition
Languages
Author (1):
Iván Pastor Sanz Iván Pastor Sanz
Profile icon Iván Pastor Sanz

Implementing descriptive analysis

Descriptive statistical analysis helps you to understand your data properly. Although R provides some functions by default to perform basic statistics, we will use two better alternatives, the DataExplorer and fBasics packages.

Follow these simple steps:

  1. As the number of variables in the dataset is high, we will create a list with the variable names to use in our descriptive functions:
Class<-as.data.frame(sapply(train, class))
colnames(Class)<-"variable_class"
Class$variable_name<-colnames(train)

numeric_vars<-Class[Class$variable_class=="numeric","variable_name"]
  1. A list of 1,492 variables is created. Pass this list to the basicStats function included in the fBasics package:
library(fBasics)
descriptives_num<- as.data.frame(t(basicStats(train[,numeric_vars])))
head(descriptives_num)
...
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 $15.99/month. Cancel anytime}