Chapter 1 Setting up your Machine

We’ll be using a variety of different software programs to write, manage, and execute the code that we write. Unfortunately, one of the most frustrating and confusing barriers to working with code is simply getting your machine properly set up. This chapter aims to provide sufficient information for setting up your machine, and troubleshooting the process.

Note that iSchool lab machines should have all appropriate software already installed and ready to use.

In short, you’ll need to install the following programs: see below for more information / options.

  • Git: A set of tools for tracking changes to computer code (especially when collaborating with others). This program is already installed on Macs.

    • GitHub: A web service for hosting code online. You don’t actually need to install anything GitHub (it uses git), but you’ll need to sign up for the service.
  • Bash: A command-line interface for controlling your computer. git is a command-line program so you’ll need a command shell to use it. Macs already have a Bash program called Terminal. On Windows, installing git will also install a Bash shell called Git Bash, or you can try the (experimental) Linux subsystem for Windows 10.

  • Atom: A lightweight text editor that supports programming in lots of different languages.

    • You are welcome to use another text editor if you wish; some further suggestions are included.
  • R: a programming language commonly used for working with data. This is the primary programming language used throught this book. “Installing R” actually means installing tools that will let your computer understand and run R code.

  • RStudio: An graphical editor for writing and running R code. This will soon become our primary development application.

The following sections have additional information about the purpose of each component, how to install it, and alternative configurations.

1.1 Git

git is a version control system that provides a set of commands that allow you to manage changes to written code, particularly when collaborating with other programmers (much more on this in chapter 4). To start, you’ll need to download and install the software. If you are on a Mac, git should already be installed.

If you are using a Windows machine, this will also install a program called Git Bash, which provides a text-based interface for executing commands on your computer. For alternative/additional Windows command-line tools, see below.

1.1.1 GitHub

GitHub is a website that is used to store copies of computer code that are being managed with git (think “Imgur for code”). Students in the INFO 201 course will use GitHub to turn in programming assignments.

In order to use GitHub, you’ll need to create a free GitHub account, if you don’t already have one. You should register a username that is identifiable as you (e.g., based on your name or your UW NetID). This will make it easier for others to determine out who contributed what code, rather than needing to figure out who ‘LeetDesigner2099’ is. This can be the start of a professional account you may use for the rest of your career!

1.2 Command-line Tools (Bash)

The command-line provides a text-based interface for giving instructions to your computer (much more on this in chapter 2). With this book, you’ll largely use the command-line for navigating your computer’s file structure, and executing commands that allows you to keep track of changes to the code you write (i.e., version control with git).

In order to use the command-line, you will need to use a command shell (a.k.a. a command prompt). This is a program that provides the interface to type commands into. In particular, we’ll be working with the Bash shell, which provides a particular common set of commands common to Mac and Linux machines.

1.2.1 Command-line on a Mac

On a Mac you’ll want to use the built-in app called Terminal. You can open it by searching via Spotlight (hit Cmd () and Spacebar together, type in “terminal”, then select the app to open it), or by finding it in the Applications/Utilities folder.

1.2.2 Command-line on Windows

On Windows, we recommend using Git Bash, which you should have installed along with git (above). Open this program to open the command-shell. This works great, since you’ll primarily be using the command-line for performing version control.

  • Note that Windows does come with its own command-prompt, called the DOS Prompt, but it has a different set of commands and features. Powershell is a more powerful version of the DOS prompt if you really want to get into the Windows Management Framework. But Bash is more common in open-source programming like we’ll be doing, and so we will be focusing on that set of commands.

Alternatively, the 64-bit Windows 10 Anniversary update (August 2016) does include a beta version of an integrated Bash shell. You can access this by enabling the subsystem for Linux and then running bash in the command prompt. This is currently (May 2017) “beta” technology, but will suffice for our purposes if you can get it running.

1.3 Text Editors

In order to produce computer code, you need somewhere to write it (and we don’t want to write it in MS Word!). There are a variety of available programs that provide an interface for editing code. A major advantage of these programs is that they provide automatic formatting/coloring for easier interpretation of the code, along with cool features like auto-completion and integration with version control.

RStudio has a great built-in text editor, but you’ll sometimes want to use another text editor which is lighter weight (e.g., runs faster), more robust, or supports a different programming language. There are lots of different text editors out there, all of which have slightly different appearances and features. You only need to download and use one of the following programs (we recommend Atom as a default), but feel free to try out different ones to find something you like (and then evangelize about it to your friends!)

1.3.1 Atom

Atom is a text editor built by the folks at GitHub and has been gaining in popularity. As an open source project, people are continually building (and making available) interesting/useful extensions. Its built-in spell-check is a great feature, especially for documents that require lots of written text. It also has excellent support for Markdown, a markup language you’ll be using regularly in this course.

To Download Atom, visit their webpage and click the “Download” button to download the installer .exe file, then double-click on that icon to install the application.

Once you’ve installed Atom, you can open the program and create a new text file. When you save a document that is a particular file-type (i.e., file-name.R, or, Atom (or any other modern text-editor) will apply a language specific color scheme to your text, making it easier to read.

The trick to using Atom more efficiently is to get comfortable with the Command Palette. If you hit Cmd+Shift+P, Atom will open a small window where you can search for whatever you want the editor to do. For example, if you type in markdown you can get list of commands related to Markdown files (including the ability to open up a preview).

For more information about using Atom, see the manual.

1.3.2 Visual Studio Code

Visual Studio Code (or VS Code; not to be confused with Visual Studio) is a free, open-source editor developed by Microsoft—yes, really. While it focuses on web programming and JavaScript, it readily supports lots of languages including Markdown and R and provides a number of extensions for adding even more features. It has a similar command palette to Atom, but isn’t quite as nice for editing Markdown specifically. Although fairly new, it is updated regularly and has become one of our main editors for programming.

1.3.3 Sublime Text

Sublime Text is a very popular text editor with excellent defaults and a variety of available extensions (though you’ll need to manage and install extensions to achieve the functionality offered by other editors out of the box). While the software can be used for free, every 20 or so saves it will prompt you to purchase the full version.

1.4 R Language

The primary programming language you will use throughout this book is called R. It’s a very powerful statistical programming language that is built to work well with large and diverse datasets. See the Introduction to R chapter for a more in-depth introduciton to the language.

In order to program with R, you will need to install the R Interpreter on your machine. This is a piece of software that is able to “read” code written in R and use that code to control your computer, thereby “programming” it.

The easiest way to install R is to download it from the Comprehensive R Archive Network (CRAN) at Click on the appropriate link for your operating system in order to find a link to the installer.

  • On a Mac, you’re looking for the .pkg file—get the latest version supported by your computer.
  • On Windows, following the link to the base subdirectory (or following the link to “install R for the first time”), then click the link to download the latest version of R for Windows. You will need to double-click on the .exe file to install the software.

1.5 RStudio

While you are able to execute R scripts without an interface, the RStudio application provides a wonderful way to engage with the R language. RStudio is described in more detail in Introduction to R

To install the RStudio program, select the installer for your operating system from the downloads page. Make sure to download the free version:

File to choose for downloading RStudio. Image may not show the latest version.

File to choose for downloading RStudio. Image may not show the latest version.

Once the download completes, double-click on the .exe or .dmg file to run the installer. Simply follow the steps of the installer, and you should be prepared to use RStudio.


Links to the recommended software are collected here for easy access: