You are here

This book is built on the premise that anyone can learn to use the R software. The authors emphasize using R to do useful things like writing papers and reports, creating data and graphs, accessing datasets collected by others, preparing data, and conducting simple data analysis. After a first chapter on installing the software and project setup, the second chapter shows how to write an essay using R Markdown, rewarding readers with an immediate tangible result, and taking the fear out of working with a new software. After walking readers step by step through data creation, visualization, preparation, access, and exploration across the next four chapters, the book ends on a high note of writing an empirical research paper in R. Student-friendly language and examples (e.g. binge-watched shows on Netflix, top 5 songs on Spotify), cumulative learning and repetition across chapters, and practice exercises make this a must-have guide for a variety of courses where data is used and reports need to be written (including, but not limited to intro statistics and research methods). Code and datasets used to carry out the examples in the book are available on an accompanying website.

Why should you learn R, too?

Who should read this book? What do we hope to achieve?

What is in this book? How do yo use it?

What is unique about this book?

Chapter 1: Making Preparations: Software Installation and Project Setup

How to download and install R for Windows

How to download and install R for Mac

Download and install RStudio

Set up a project in RStudio

Create folders under project


Chapter 2: Writing an Essay Using R Markdown: Something for Everyone

The pros of using R Markdown

How to create an R Markdown file

How to write and format text in R Markdown

A simple example of an R Markdown document

Other useful formatting tricks

How to use R Markdown for a writing example: A bare bones example

How to revise and improve the bare bones essay

For more ambitious readers

Exercise: Turning knowledge into results


Chapter 3: Creating Data and Graphs in Reports

Bar plot: Graphing the winners of a hot dog eating contest

Bar plot II: Graphing the winning lottery numbers in Texas Pick-3

Pie chart: Graphing the composition of daily plays among Top 5 songs on Spotify

Histogram: Graphing the distribution of LSAT scores in a review class

Scatter Plot: Graphing the relationship between two variables - gas mileages in city and on highway

Time-series plot: Graphing the changing pattern of Youtube video news.

Useful tips: Polishing and exporting graphs


Chapter 4: Preparing Your Data

Writing and running a program in R

Creating your variables and dataset

Manipulating your data using the dplyr package

Rename a variable

Chaining different data manipulation operations

Missing value in R: NA


Chapter 5: Accessing Datasets

Setting up RStudio project

Downloading dataset

Installing R packages for data importing

Importing downloaded dataset in RStudio

Using R data packages: A simple example with gapminder

Using R data packages: A more advanced example with wbstats

Using R data packages: Finding more R data packages

Where do you find more data?


Chapter 6: Exploratory Data Analysis: Three Exercises

Exercise 1: Reporting results of 2016 presidential primary in King County, Washington

Exercise 2: Human use of natural resources: Consumption and biocapacity

Exercise 3: Exploring the impact of GDP per capita on life expectancy


Chapter 7: Writing a Research Paper Using R: Analyzing the Effect of Economic Development on Life Expectancy

Arguments and Hypothesis

Data and Method



Appendix: Summary Statistics and Codebook


Preview this book

For instructors

Please select a format:

Select a Purchasing Option

Electronic version
Prices from
*180 day rental

ISBN: 9781544379418