In lab, we will use Jupyter notebooks to organize and record our activities. We will manage these notebooks using Anaconda.
Anaconda is an environment manager for Python and other high-level programming languages such as R. It is free, open-source, and easy to install on any operating system (OS). Anaconda Navigator is a graphical interface to the conda command for creating and using environments, i.e., customized sets of code libraries for particular tasks or projects.
We will take advantage of Anaconda Navigator to set up the computing environment that includes the programs and packages we need for lab, including in particular the Jupyter Notebook.
If you want to try out Anaconda or its derivatives, e.g. Miniconda, on your own computer, refer to these installation instructions.
A conda environment is like a "sandbox" into which you can install the packages you need for a particular task. This way, you can make different environments for different projects. So, let's make one to use throughout the quarter -- let's call it rtol -- and populate it with some essential packages.
We will use Anaconda Navigator already installed on lab computers to set up the conda environment. Anaconda Navigator is a GUI (graphic user interface) software that makes the conda setup easy without the use of command lines.
Open the Anaconda Navigator by searching the app on your computer. On the menu bar, click Environments, this will lead you to the interface where you can manage all environments created.
Click create at the bottom left corner. Type in rtol as name and choose both python 3.8 and R to include both packages. Wait while Anaconda is fetching the requested packages, this might take a while.
Browsing and managing packages
After rtol is created, we can look at the included packages by browsing the list.
In addition to the automatically fetched packages, we also need to install the R package ape. To do so, select Not installed or All from the drop-down list on the top. Then, type in r-ape to search for the package. Click the box of r-ape found in the list and click apply to install.
Now, we are ready to start using Jupyter Notebook under the rtol environment.
Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, etc.[2]
Select rtol on the environment menu. Click the arrow and then select the option Open with Jupyter Notebook.
This will open a browser window showing files and folders in the home directory. You can now browse through directories similar to the way in your computer file systems.
Jupyter Notebook files are conventionally named with an .ipynb extension, reflecting their derivation from IPython notebooks.
Open: Locate yourself to the directory with the existing notebook file and click on the file with .ipynb extension.
Create: Click the New drop-down button in the top-right and select R.
Sources:
[1] https://www.flickr.com/photos/stephenjjohnson/3844461788, accessed Sept 21 2021.
[2] https://jupyter.org/, accessed Sept 22 2021.