R for Excel Users
R for Excel Users
An Introduction to R for Excel Analysts
About the Book
While Excel might continue to be your bread-and-butter, knowing R and applying it at the right times can make you a more productive and effective analyst. This book is for beginners, and the goal is to get you started. R is known to have a steep learning curve, but I really think it has three separate curves: (1) data management, (2) statistics and (3) visualization.
The focus of this book will be on data management: how to import, manipulate, transform and summarize data through the use of functions. Once you understand and are able to work with data structures, applying analytical techniques is a relative breeze.
For example, running a linear regression is a simple command that looks like this:
lm(y ~ x1 + x2 + ... xn, data = dataset_name)
That's easy, and if you understand regression, then interpreting the output will also be easy. But getting your data set in the right format, combining it with other data sets, manipulating columns, filtering rows, etc -- that is the hurdle I will help you overcome.
Table of Contents
-
- Preface
- About me
-
Part 1 - Introduction & Set Up
-
1. Getting Set Up
- 1.1 Getting mentally ready to write code
- 1.2 Downloading the software
- 1.3 Navigating the software
- 1.4 Using other Software
- 1.5 Libraries
- 1.6 Console tips
- 1.7 Getting help
-
2. Programming Basics
- 2.1 Assigning variables
- 2.2 Testing conditions
- 2.3 Data structures
- 2.4 Special values
- 2.5 Commenting your code
- 2.6 Control Structures
-
3. Quick Start - Analysis Examples
- 3.1 Example 1: General data analysis
- 3.2 Example 2: Using SQL in R
- 3.3 Example 3: Multiple regression model
- 3.4 Summary
-
1. Getting Set Up
-
Part 2 - Building Blocks: Cells and Formulas
-
4. Cells are Vectors
- 4.1 Individual cells
- 4.2 Cell ranges
- 4.3 They are all vectors
- 4.4 Why vectors matter
- 4.5 Working with vectors
- 4.6 How vector operations work
- 4.7 Summary
-
5. Formulas are Functions
- 5.1 Inputs
- 5.2 Outputs
- 5.3 Getting help on functions
- 5.4 Some base functions
- 5.5 Create your own functions
- 5.6 Summary
-
4. Cells are Vectors
-
Part 3 - Data Frames
-
6. Import and Create Data Sets
- 6.1 Importing from .csv and .txt files
- 6.2 Importing from .xlsx files
- 6.3 Creating a data frame
- 6.4 Deleting a data frame
- 6.5 Summary
-
7. Inspect Your Data
- 7.1 Sneak a peek with brackets
-
7.2 Sneak another peek with
head()
andtail()
-
7.3 Data structure -
str()
-
7.4 Column names -
names()
-
7.5 Summary stats -
summary()
-
7.6 Inspecting columns -
unique()
,table()
and others - 7.7 Visually understand your data
- 7.8 Other quick inspection functions
- 7.9 Summary
-
8. Working with Columns
- 8.1 Refer to columns
- 8.2 Create columns
- 8.3 Reformat columns
- 8.4 Rename columns
- 8.5 Remove columns
- 8.6 Unbound columns
- 8.7 Summary
-
9. Working with Rows
- 9.1 Filtering with brackets
-
9.2 Filtering with
subset()
-
9.3 Filtering uniques with
unique()
-
9.4 Sorting with
order()
-
10. Manipulating Rows and Columns with dplyr
- 10.1 sqldf
- 10.2 dplyr - manipulation verbs
- 10.3 Application: by-group processing with dplyr
- 10.4 Summary
-
6. Import and Create Data Sets
-
Part 4 - Shape your Dataset
-
11. Combine Data Tables
-
11.1
merge()
- vlookup on steroids -
11.2
merge()
options -
11.3 Merging with
sqldf()
- 11.4 Merging with dplyr
- 11.5 Summary
-
11.1
-
12. PivotTables - Summarize and Transpose your Data
- 12.1 Making a simple PivotTable
- 12.2 Reshaping the table
- 12.3 Summary
-
11. Combine Data Tables
-
Part 5 - Advanced Topics
-
13. Working with lists
- 13.1 What is a list?
- 13.2 Two common uses
- 13.3 How to get things from lists
- 13.4 Creating and modifying lists
- 13.5 Basic list functions
- 13.6 Summary
-
14. Programming: Loops and Control Flow
-
14.1
while()
loop -
14.2
for()
loop - 14.3 Breaking out of or skipping loops
-
14.4
if()
- 14.5 Summary
-
14.1
-
15. Writing your own functions
- 15.1 Simple function - Custom table summary
- 15.2 More advanced function
- 15.3 Summary
-
16. Apply Family of Functions
-
16.1
lapply()
,sapply()
andmapply()
-
16.2
apply()
- 16.3 Summary
-
16.1
-
17. Text / String Extraction
-
17.1 Using
substr()
to mimic LEFT() and RIGHT() -
17.2 Using
strsplit()
and apply functions - 17.3 Regular Expression Text Extraction
- 17.4 Summary
-
17.1 Using
- Next Steps
-
13. Working with lists
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them