Setting Up Your Programming Environment

In this course, you will learn foundational concepts and techniques in programming for data science.

To complete the work in this course, you will need the tools to write and run source code in the Python or R programming languages. Specifically, you will need the following:

  1. An installed interpreter for the given language.
  2. A text editor to write the program files.
  3. A means to run the program file with the interpreter.

Together, these resources constitute your programming environment.

Choices, choices

For each of these items, you have many options. For example, you may have a version of Python that is already installed on your computer, or you may download and install a distribution, such as that provided by Anaconda. For R, you will need to have the R program installed on your computer, which is typically provided by the Comprehensive R Archive Network (CRAN).

There are many, many choices for editors, ranging from simple text editors like BBEdit on Mac and NotePad++ for Windows to VS Code, Jupyter Lab, RStudio, and other IDEs (integrated development environments).

In this course, the assumption is that you are beginning your knowledge journey, so you would be better served by having a simpler editor that does not presume that you already know things like how to set break points in your code. Also, as a matter of principle, it is better to have an editor that is not busy suggesting what you do next with pop-ups and code completions. As you acquire competence as a coder, AI agents and other helper tools will be useful to you. You will definitely want to use them. But, paradoxically, in the beginning they just get in your way.

Regarding the means to run your programs with the interpreter, the simplest way is to run the program from the command line, using the terminal application. For example, to run the program hello_world.py with an installed version of Python, you will do something like this, where $ is the command prompt (which varies):

$ python hello_world.py

After pressing return, the Python interpreter python will execute any commands in the file and display the results. For example, if hello_world.py contains the line print("Hello, World!"), then the result on the command line would be:

Hello, World!

Programs may also be run from within a text editor or IDE, for example using “play” buttons that avoid interaction with the command line. In the case of R, by far the IDE of choice is RStudio. For Python, popular choices include PyCharm, Spyder, Jupyter Lab, and VS Code. Recently, VS Code has become very popular.

Because of the vast number of possible combinations of interpreter, editor, modes of execution, and operating systems, we will not recommend a specific configuration for you. However, if you don’t already have installed the tools to create and run Python and/or R programs, we do suggest the following resources.

Important

Although we do not provide specifications for your entire programming environment, we do expect that you have installed a version of Python \(>=\) 3.9 and R \(>=\) 4.3.

Free Cloud Resources

Luckily, we live in an era where there are good, free resources to get started on your coding journey. Among these we suggest that you use the following if you don’t have something already:

For Python, use Anaconda Cloud. This resource provides access to computing, storage, and Jupyter Lab to write and run Python scripts in either plain text form or as Jupyter notebooks.

For R, use Posit Cloud. This resource provides access to computing, storage, and R Stdudio to write and run R scripts in plain text form or as RMarkdown notebooks.

Both of these resources have a free tier which is perfectly adequate for the work in this course.

In both cases, you will write you code on the server. To submit work to Canvas, you will simply download your program files to your local computer and then upload them to the proper assignment in Canvas.

By using these cloud resources, you can focus on learning without worrying about setting up a local development environment.