**Research Design for Causal Inference**

Congratulations! You're getting started with R.

First things first: before our tutorial session, please:

Make sure you have a satisfactory setup for statistical computing. If you are working with R, Download & install it. You will also want to pick and install a development environment for R: I recommend Rstudio. If, and only if, you use Emacs, you may want to try Emacs Speaks Statistics (ESS).

Learn (or review) statistical computing basics: if you're completely new to R, you might take the Try R course. Also, this Getting started with R page from York University contains a variety of tutorials, tips, and instructional resources. Among the best is Kelly Black's R Tutorial. I am also a big fan of the UCLA statistical consulting resources, including their R Intro class notes; learning modules; and data analysis examples. The Quick-R resources are excellent too.

The objective of this session is to provide you with a brief orientation to R. By the end, you should feel more comfortable interacting with R; independently acquire skills to help you complete the first problem set; evaluate your progress acquiring those skills; and posses the ability to learn more on your own.

Below are are a list of the critical skills (divided into three "modules") you should aim to learn in order to be able to use R to complete problem sets (don't worry, many of these skills are very quick!). Each module has a separate page that contains more detailed information and example code (apologies, these separate pages also look different from the rest of the site at the moment). In some cases, the skills are self-explanatory --- either you can complete them successfully or not. Where necessary, I have provided you with some tasks/tests that you can use to assess whether you "get it" or not.

The big idea here is that you can start working through these modules or another tutorial (really any tutorial or example code will do) at your own pace and, whenever you're ready, assess your ability to perform the tasks listed in the modules. If you prefer, you can also just skip around and focus on the stuff you don't immediately understand. It's up to you.

- Install R as well as an Interactive Development Environment (IDE) such as RStudio.
- Run a command in the R console directly. Run a command through a script.
- Lookup help and documentation.
- Install and load "packages" (also known as "libraries").
- Find and change your working directory.
- Load a data file (either .RData or .csv).
- Know what's in your workspace.

- Do some basic math problems.
- Assign values to objects (you can use either the
`=`

operator or the`<-`

operator). - Identify and change ("cast") the class of an object.
- Basic operations with different data structures (e.g., vectors, matrices, and data frames).
- Inspect and describe data frames.
- Calculate some descriptive statistics and transform variables.

- Generate a sequence.
- Generate a vector by repeating some numbers.
- Index into a variable or a data frame.
- Analyze subsets of a dataframe (make sure to load the problem set data again).
- Run and summarize a linear regression.
- Run a loop.
Use a vectorized function like

`tapply()`

.