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
Machine Learning with R Quick Start Guide

You're reading from   Machine Learning with R Quick Start Guide A beginner's guide to implementing machine learning techniques from scratch using R 3.5

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781838644338
Length 250 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Iván Pastor Sanz Iván Pastor Sanz
Author Profile Icon Iván Pastor Sanz
Iván Pastor Sanz
Arrow right icon
View More author details
Toc

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 $19.99/month. Cancel anytime
Banner background image