Chapter 5

Coding in R Using RStudio

IN THIS CHAPTER

Discovering the basic R data types

Using vectors in R

Creating and using data lists

Using matrices in R

Defining multiple dimensions using arrays

Working with data frames

Using R to perform statistical tasks

Before you can work effectively with R, you need to know something about it. People have written entire books, dedicated websites, and created training courses on the subject of working with R and most likely haven’t exhausted the topic yet. This chapter serves as a simple overview of R. The purpose of this chapter is to give you enough information to understand the examples throughout the rest of the book. It’s designed around the needs of someone who already knows how to perform basic coding and just needs some information about R to get more out of the material that appears in the chapters that follow.

One thing that this chapter does that you won’t find in other books, websites, and so on is a slant toward machine learning. You aren’t just getting an overview, but an overview that helps you understand R from a machine learning perspective. For this reason, you might want to scan the chapter even if you already know something about R. This chapter doesn’t make you an R genius, but it does help prepare you for using R in a machine learning environment.

Understanding the Basic Data Types

In contrast to most programming languages, R doesn’t require you to declare a variable of a specific type. R stores data in R-objects. ...

Get Machine Learning For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.