Search icon CANCEL
Subscription
0
Cart icon
Cart
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
Arrow up icon
GO TO TOP
Data Wrangling with R

You're reading from  Data Wrangling with R

Product type Book
Published in Feb 2023
Publisher Packt
ISBN-13 9781803235400
Pages 384 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Gustavo R Santos Gustavo R Santos
Profile icon Gustavo R Santos
Toc

Table of Contents (21) Chapters close

Preface 1. Part 1: Load and Explore Data
2. Chapter 1: Fundamentals of Data Wrangling 3. Chapter 2: Loading and Exploring Datasets 4. Chapter 3: Basic Data Visualization 5. Part 2: Data Wrangling
6. Chapter 4: Working with Strings 7. Chapter 5: Working with Numbers 8. Chapter 6: Working with Date and Time Objects 9. Chapter 7: Transformations with Base R 10. Chapter 8: Transformations with Tidyverse Libraries 11. Chapter 9: Exploratory Data Analysis 12. Part 3: Data Visualization
13. Chapter 10: Introduction to ggplot2 14. Chapter 11: Enhanced Visualizations with ggplot2 15. Chapter 12: Other Data Visualization Options 16. Part 4: Modeling
17. Chapter 13: Building a Model with R 18. Chapter 14: Build an Application with Shiny in R 19. Conclusion 20. Other Books You May Enjoy

Numbers in vectors, matrices, and data frames

A number represents a point in space. You may also have heard of a number being referred to as a scalar when it is followed by a unit of measure. In other words, it is a variable with a single number. When we have more than one number, it is possible to create a line in space, which is referred to as a vector. A collection of vectors put together gives new dimensions to data, which becomes matrices or data frames. These last two are similar structures, but data frames have some more enhanced features, such as headers and indexes, that help us to work with the information held by them.

We can quickly go over scalar, vector, matrix, and data frame creation in R, which is a simple process. You can understand what is being done by reading the comments:

# Creating a scalar
scalar <- 42
print(scalar)
[1] 42
# Creating a vector
vec <- c(1, 2, 3, 4, 5, 6, 7, 8, 9)
print(vec)
[1] 1 2 3 4 5 6 7 8 9
# Creating a Matrix
mtrx <- matrix...
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