Prerequisites
Knowledge prerequisites
The materials in this book assume that you already know something (but not necessarily a great deal) of the languages R and Python, so there won’t be any introduction to the languages themselves. The rest of this chapter will help you set up the software you need to practice with those tools.
Software prerequisites
You need to install the following stuff for this book:
- R
- RStudio
- Some R packages:
rmarkdown
,knitr
- Python 3 via Anaconda
- A reasonably recent web-browser
Installing R
Follow this link and install the right version for your operating system https://www.stats.bris.ac.uk/R/
Installing RStudio
Follow this link and install the right version for your operating system https://www.rstudio.com/products/rstudio/download/
Installing R packages in RStudio
Standard packages
In the RStudio console, type
install.packages(c("rmarkdown", "knitr"))
Installing Python 3 with Anaconda
Follow this link and install Python 3.x for your operating system. https://www.anaconda.com/distribution/
Note for macOS users
Accept all of the defaults during installation
Here is a video tutorial https://www.youtube.com/watch?v=TcSAln46u9U
Note for Windows users
Install Python 3 using all of the defaults for installation except make sure to check Add Anaconda to my PATH environment variable.
Here is a video tutorial https://www.youtube.com/watch?v=xxQ0mzZ8UvA
Note for Linux Users
You’ll need to be able to use the command-line to install with Anaconda. If you aren’t comfortable with this, ask for assistance from the local support team.
- Open https://www.anaconda.com/download/#linux with your web browser.
- Download the Python 3 installer for Linux.
- Open a terminal window. 4.Type
bash Anaconda3-
and then press Tab. The name of the file you just downloaded should appear. If it does not, navigate to the folder where you downloaded the file, for example with:cd Downloads
. Then, try again. - Press
enter
. You will follow the text-only prompts. To move through the text, press thespacebar
. - Type
yes
and pressenter
to approve the license. - Press
enter
to approve the default location for the files. - Type
yes
and pressenter
to prepend Anaconda to yourPATH
(this makes the Anaconda distribution the default Python). - Close the terminal window.
Starting a Jupyter Notebook
macOS
- Start the
Terminal
application inApplications -> Utilities
- Type
jupyter notebook
, it should start in your web browser
Windows
- From the Start menu, search for and open
Anaconda 3
orJupyter Notebook
. You should be able to start a notebook directly by clicking theJupyter Notebook
icon.
Linux
- Open the terminal application. It is usually in the task bar or dock
- Type
jupyter notebook
, it should start in your web browser
Installing Python Packages with conda
You can use conda
to install new Python packages using the Terminal by typing conda install <package_name>
.
You can install the required packages with the following commands:
conda install jupyter
Accept all defaults when the system asks a question.