Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
R Programming Fundamentals

You're reading from   R Programming Fundamentals Deal with data using various modeling techniques

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher
ISBN-13 9781789612998
Length 206 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Kaelen Medeiros Kaelen Medeiros
Author Profile Icon Kaelen Medeiros
Kaelen Medeiros
Arrow right icon
View More author details
Toc

Chapter 3: Data Management

The following are the activity solutions for this chapter.

Activity: Creating and Manipulating Factor Variables

Use the following code to load the datasets library:

library(datasets)

Use the following code to load the diamonds dataset:

data("diamonds")

The function str() can be used to examine the diamonds dataset as follows:

str(diamonds)

We understand that there are three factors of ordered type as we examine the diamonds dataset. To identify the class of those factors, we can use the function class() as follows:

class(diamonds$cut)
class(diamonds$color)
class(diamonds$clarity)

The following code can be used to load the midwest dataset:

data("midwest")

The str() function can be...

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 ₹800/month. Cancel anytime