Edit the source list to add the R package use this:
```
sudo nano /etc/apt/sources.list
```
24.04
`deb https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/`
22.04
`deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/`
20.04
`deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/`
next add key
```
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
```
then do update
`sudo apt update`
Now you can install with
```
sudo apt install r-base r-base-dev
```