Practical Session 2
Working with notebooks.
Installing IRkernel
On elcattivo
start a R session R-4.1.0
and to install the IRkernel using:
install.packages('IRkernel')
allow a personal installation in your home-dir type yes
, yes
, 41
. Then go on and install the kernel
IRkernel::installspec()
Editing a notebook on a remote computer via VS Code
Locally open VS Code
and click on the 3+1 squares icon on the left and install packages
Remote - SSH
Jupyter
Open the Command Palette
. Choose Remote SSH: Connect to host ...
. Choose elcattivo
, click New File
, choose Jupyter Notebook
shift
+return
to execute a cell
jupyter lab
Editing a notebook on a remote computer via
connect to ecattivo ssh elcattivo
and once there run
jupyter lab --no-browser --port PORT --ip \*
and point your local browser to the last link given in the terminal output, which reads simialr to http://127.0.0.1:22222/lab?token=e599ae3d639721c64d9c25adb9e840fa59e1
. make sure to take the link with 127.0.0.1
Once the ssh connection is lost, your jupyter lab session will most likely be shutdown. While notebooks themselves will probably be saved, all intermediate results in your kernel session will be lost. Better run yupyter lab in a tmux
session. Type tm
, which is aliased to tmux attach || tmux new
(see above), before starting it.
Assignment
Generate a notebook with a plot. Using the R
kernel you may just type into a code cell
plot(rnorm(100), rnorm(100))
Also generate a markdown cell to document what you have done:
This is a plot of two uncorrelated normal distributions.
Do this inside VS Code and in Jupyter. Send two screen-shots.