Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
NanoCourseReproducibleResearch/PracticalSession-2.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
67 lines (36 sloc)
1.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
![](figures/notebook-setup-vscode.png) | |
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 | |
## Editing a notebook on a remote computer via `jupyter lab` | |
![](figures/notebook-setup-jupyter.png) | |
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 | |
```r | |
plot(rnorm(100), rnorm(100)) | |
``` | |
Also generate a markdown cell to document what you have done: | |
```markdown | |
This is a plot of two uncorrelated normal distributions. | |
``` | |
Do this inside VS Code and in Jupyter. Send two screen-shots. |