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

Data overview

First, we are going to analyze the types of variables that we have in the dataset. For that, we can use the class function, which tells us whether a variable is a number, a character, or a matrix. For example, the class of the identifying number of a bank ID_RSSD can be obtained as follows:

class(Model_database$ID_RSSD)

## [1] "integer"

This function indicates that this variable is a number without decimals.

We can calculate the same information for all the variables and store it using the following code:

 classes<-as.data.frame(sapply(Model_database, class))
classes<-cbind(colnames(Model_database),classes)
colnames(classes)<-c("variable","class")

With sapply, calculate iteratively the class function on the dataset. Then, combine the name of variables with the class in only a data frame, and, finally, rename the resulting dataset...

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}