An Introduction to R and Python for Data Analysis cover

266 pages · 2023

Catalog title1st Edition

An Introduction to R and Python for Data Analysis

A Side-By-Side Approach

By Taylor R. Brown

Published
June 28, 2023
Imprint
Chapman and Hall/CRC
Edition
1st Edition
ISBN
9781003263241

Overview

About this book

An Introduction to R and Python for Data Analysis helps teach students to code in both R and Python simultaneously. As both R and Python can be used in similar manners, it is useful and efficient to learn both at the same time, helping lecturers and students to teach and learn more, save time, whilst reinforcing the shared concepts and differences of the systems. This tandem learning is highly useful for students, helping them to become literate in both languages, and develop skills which will be handy after their studies. This book presumes no prior experience with computing, and is intended to be used by students from a variety of backgrounds. The side-by-side formatting of this book helps introductory graduate students quickly grasp the basics of R and Python, with the exercises providing helping them to teach themselves the skills they will need upon the completion of their course, as employers now ask for competency in both R and Python. Teachers and lecturers will also find this book useful in their teaching, providing a singular work to help ensure their students are well trained in both computer languages. All data for exercises can be found here: https://github.com/tbrown122387/r_and_python_book/tree/master/data. Instructors can access the solutions manual via the book's website.

Key features:

Teaches R and Python in a "side-by-side" way Examples are tailored to aspiring data scientists and statisticians, not software engineers Designed for introductory graduate students Does not assume any mathematical background

Subjects

Computer Science, Mathematics & Statistics

Inside the book

Table of contents

Select a chapter to read its abstract.

Part IIntroducing the Basics

Pages: 110

No chapter abstract available.

Chapter Chapter 1Introduction

Pages: 8

In this chapter, we take our first look at R and Python's integrated development environments (IDEs). We discuss printing objects, consulting documentation, and getting and setting working directories.

Chapter Chapter 2Basic Types

Pages: 6

Computer programs manipulate data, and how one manipulates data depends on how it is stored. This chapter discusses the foundational types of objects in our R and Python programs.

Chapter Chapter 3R Vectors versus Numpy arrays and Pandas' Series

Pages: 30

One-dimensional containers are useful because they store many objects in one place. This chapter discusses how to access and manipulate elements in these containers and some common sources of confusion in doing so.

Chapter Chapter 4Numpy ndarrays versus R's Matrix and array Types

Pages: 12

This chapter higher dimensional containers of homogeneous data. In R, we have the matrix and array classes. In Python, we have Numpy ndarrays.

Chapter Chapter 5R's lists versus Python's lists and dicts

Pages: 6

This chapter discusses one-dimensional containers of heterogeneous data and containers that store key-value pairs.

Chapter Chapter 6Functions

Pages: 22

This chapter goes more into depth on functions. Here we will learn to define functions ourselves, and in doing so, we will learn about how functions work in detail. Familiarity with this chapter is a prerequisite for a deep understanding of chapter 15.

Chapter Chapter 7Categorical Data

Pages: 10

How should one store categorical data? As an integer? As a string? Neither? This chapter discusses types that are specifically designed for representing categorical data.

Chapter Chapter 8Data Frames

Pages: 14

Data frames are hands down the most important data container in both R and Python. This chapter compares and contrasts data frames in both languages.

Part IICommon Tasks and Patterns

Pages: 72

No chapter abstract available.

Chapter Chapter 9Input and Output

Pages: 14

How should one interface with data sets stored outside of an R or Python session? This chapter discusses reading data from external sources, as well as writing it out as a flat file or in a serialized form.

Chapter Chapter 10Using Third-Party Code

Pages: 10

Using third-party libraries and packages is easy in R and Python. This chapter discusses installing third-party software, as well as how to make it accessible from within an R or Python session.

Chapter Chapter 11Control Flow

Pages: 12

This chapter demonstrates how conditionally execute code in both R and Python, and it shows how to use loops to run code an arbitrary number of times.

Chapter Chapter 12Reshaping and Combining Data Sets

Pages: 18

Combing data frames can be done in several ways. Here we show how to stack data frames on top of each other, next to each other, and merge (or join) them together in a variety of ways. We also discuss how to convert data between “wide” and “long” formats.

Chapter Chapter 13Visualization

Pages: 16

This chapter provides an introduction to common visualization libraries in both R and Python. In R, we have base graphs and ggplot2. In Python, we have Matplotlib as well as the visualization tools provided by the Pandas library.

Part IIIProgramming Styles

Pages: 58

No chapter abstract available.

Chapter Chapter 14An Introduction to Object-Oriented Programming

Pages: 28

This chapter gives a quick introduction to object-oriented programming. The primary goal of this chapter is to demonstrate how users of Python and R can define their own types. It also highlights the different approaches taken by R and Python.

Chapter Chapter 15An Introduction to Functional Programming

Pages: 28

How can one use functions as inputs to or outputs from other functions? When is this useful? How do R and Python treat these patterns differently? This chapter explores these questions and in doing so provides an initial exploration of functional programming.