An Introduction to R and Python for Data Analysis: A Side-By-Side Approach

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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.

Author(s): Taylor R. Brown
Publisher: CRC Press/Chapman & Hall
Year: 2023

Language: English
Pages: 266
City: Boca Raton

Cover
Half Title
Title Page
Copyright Page
Dedication
Contents
List of Figures
Welcome
Preface
I. Introducing the Basics
1. Introduction
1.1. Hello World in R
1.2. Hello World in Python
1.3. Getting Help
1.3.1. Reading Documentation
1.3.2. Understanding File Paths
2. Basic Types
2.1. Basic Types in Python
2.1.1. Type Conversions in Python
2.2. Basic Types in R
2.2.1. Type Conversions in R
2.2.2. R’s Simplification
2.3. Exercises
2.3.1. R Questions
2.3.2. Python Questions
3. R Vectors versus Numpy Arrays and Pandas’ Series
3.1. Overview of R
3.2. Overview of Python
3.3. Vectorization in R
3.4. Vectorization in Python
3.5. Indexing Vectors in R
3.6. Indexing Numpy arrays
3.7. Indexing Pandas’ Series
3.8. Some Gotchas
3.8.1. Shallow versus Deep Copies
3.8.2. How R and Python Handle Missing Values
3.9. An Introduction to Regular Expressions
3.9.1. Literal Characters versus Metacharacters
3.9.2. The Trouble with Backslashes: Escape Sequences
3.9.3. More Examples of Using Regular Expressions
3.10. Exercises
3.10.1. R Questions
3.10.2. Python Questions
4. Numpy ndarrays versus R’s Matrix and Array Types
4.1. Numpy ndarrays in Python
4.2. The Matrix and Array Classes in R
4.3. Exercises
4.3.1. R Questions
4.3.2. Python Questions
5. R’s lists versus Python’s lists and dicts
5.1. lists in R
5.2. lists in Python
5.3. Dictionaries in Python
5.4. Exercises
5.4.1. R Questions
5.4.2. Python Questions
6. Functions
6.1. Defining R Functions
6.2. Defining Python Functions
6.3. More Details on R’s User-Defined Functions
6.4. More Details on Python’s User-Defined Functions
6.5. Function Scope in R
6.6. Function Scope in Python
6.7. Modifying a Function’s Arguments
6.7.1. Passing by Value in R
6.7.2. Passing by Assignment in Python
6.8. Accessing and Modifying Captured Variables
6.8.1. Accessing Captured Variables in R
6.8.2. Accessing Captured Variables in Python
6.8.3. Modifying Captured Variables in R
6.8.4. Modifying Captured Variables in Python
6.9. Exercises
6.9.1. R Questions
6.9.2. Python Questions
7. Categorical Data
7.1. factors in R
7.2. Two Options for Categorical Data in Pandas
7.3. Exercises
7.3.1. R Questions
7.3.2. Python Questions
8. Data Frames
8.1. Data Frames in R
8.2. Data Frames in Python
8.3. Exercises
8.3.1. R Questions
8.3.2. Python Questions
II. Common Tasks and Patterns
9. Input and Output
9.1. General Input Considerations
9.2. Reading in Text Files with R
9.3. Reading in Text Files with Pandas
9.4. Saving Data in R
9.4.1. Writing Out Tabular Plain Text Data in R
9.4.2. Serialization in R
9.5. Saving Data in Python
9.5.1. Writing Out Tabular Plain Text Data in Python
9.5.2. Serialization in Python
9.6. Exercises
9.6.1. R Questions
9.6.2. Python Questions
10. Using Third-Party Code
10.1. Installing Packages in R
10.2. Installing Packages in Python
10.3. Loading Packages in R
10.4. Loading Packages in Python
10.4.1. Importing Examples
10.5. Exercises
11. Control Flow
11.1. Conditional Logic
11.2. Loops
11.3. Exercises
11.3.1. R Questions
11.3.2. Python Questions
12. Reshaping and Combining Data Sets
12.1. Ordering and Sorting Data
12.2. Stacking Data Sets and Placing Them Shoulder to Shoulder
12.3. Merging or Joining Data Sets
12.4. Long versus Wide Data
12.4.1. Long versus Wide in R
12.4.2. Long versus Wide in Python
12.5. Exercises
12.5.1. R Questions
12.5.2. Python Questions
13. Visualization
13.1. Base R Plotting
13.2. Plotting with ggplot2
13.3. Plotting with Matplotlib
13.4. Plotting with Pandas
13.5. Exercises
13.5.1. R Questions
13.5.2. Python Questions
III. Programming Styles
14. An Introduction to Object-Oriented Programming
14.1. OOP in Python
14.1.1. Overview
14.1.2. A First Example
14.1.3. Adding Inheritance
14.1.4. Adding in Composition
14.2. OOP in R
14.2.1. S3 Objects: The Big Picture
14.2.2. Using S3 Objects
14.2.3. Creating S3 Objects
14.2.4. S4 Objects: The Big Picture
14.2.5. Using S4 Objects
14.2.6. Creating S4 Objects
14.2.7. Reference Classes: The Big Picture
14.2.8. Creating Reference Classes
14.2.9. Creating R6 Classes
14.3. Exercises
14.3.1. Python Questions
14.3.2. R Questions
15. An Introduction to Functional Programming
15.1. Functions as Function Inputs in R
15.1.1. sapply() and vapply()
15.1.2. lapply()
15.1.3. apply()
15.1.4. tapply()
15.1.5. mapply()
15.1.6. Reduce() and do.call()
15.2. Functions as Function Inputs in Python
15.2.1. Functions as Function Inputs in Base Python
15.2.2. Functions as Function Inputs in Numpy
15.2.3. Functional Methods in Pandas
15.3. Functions as Function Outputs in R
15.4. Functions as Function Outputs in Python
15.4.1. Writing Our Own Decorators
15.5. Exercises
15.5.1. Python Questions
15.5.2. R Questions
Bibliography
Index