wget https://quarto.org/download/latest/quarto-linux-amd64.deb
sudo apt-get install -y ./quarto-linux-amd64.deb
rm quarto-linux-amd64.debSet up GitHub Codespace
Easiest Way
The easiest way to set up a GitHub Codespace with your preferred configuration is to use a .devcontainer configuration. This approach lets you define your development environment as code:
- Create a
.devcontainerfolder in your repository - Add a
devcontainer.jsonfile with your configuration
For example, the eddelbuettel/r2u repository provides a ready-to-use configuration when launching a Codespace from the repository. You can find detailed instructions in their Codespaces documentation.
Here’s a sample configuration for R and Quarto manually set by my self:
Basics for R
- Install R and Quarto
sudo apt-get update && sudo apt-get install -y r-base- Install Pandoc
sudo apt-get update && sudo apt-get install -y pandoc- Install Extension: REditorSupport
- install the requred packages:
sudo Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org/')"sudo Rscript -e "install.packages('httpgd', repos='https://cloud.r-project.org/')"
- install the requred packages:
- Install often used R packages
Before installing the devtools R package on a fresh Ubuntu system, you must:
Install system libraries required by devtools and its dependencies: - libharfbuzz-dev - libfribidi-dev - libfreetype-dev - libpng-dev - libtiff-dev - libwebp-dev - libjbig-dev - libdeflate-dev - liblerc-dev - libsharpyuv-dev
Use sudo when installing R packages to avoid permission issues. These steps ensure all necessary C/C++ libraries are available for compiling devtools and its dependencies
Note for certain packages, some additional system packages are required. From example, for PMCMRplus package, libmpfr need to be installed.
sudo apt update
sudo apt install libmpfr-devsudo Rscript -e "install.packages('devtools', repos='https://cloud.r-project.org/')"
## Example: dependencies for drcHelper
install.packages("Rmpfr")
install.packages(c(
"multcomp", "PMCMRplus", "dplyr", "tidyselect", "lme4", "bmd",
"ggplot2", "scales", "metafor", "rstatix", "DescTools", "isotone"
))
install.packages("remotes") # if not already installed
remotes::install_github("DoseResponse/bmd@a3bd9c6113e35d43e0990614469dabb10cd409bd")
remotes::install_github("DoseResponse/drc")
remotes::install_github("DoseResponse/drcData")To clean up lock files and install a package: rm -f /home/codespace/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-ragg && Rscript -e "install.packages('ragg', repos='https://cloud.r-project.org/')"
For rendering the pkgdown website, additional packages are neede
install.packages(c(
"GLMcat", "kableExtra", "emmeans", "outliers", "drda", "pander", "ggnewscale", "patchwork", "ggprism", "plyr","MCPMpd"
))Setting Local R library
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE, showWarnings = FALSE)
.libPaths(Sys.getenv("R_LIBS_USER"))
devtools::install()Install radian
## Ubuntu 23.04 or above, my current code space is 4.24
lsb_release -a
sudo apt update
sudo apt install pipx
pipx ensurepath# install released version
pipx install radian
# or the dev version
pipx install git+https://github.com/randy3k/radian
# to run radian
radianTo find out the path of radian: which radian.
To associate R code execution in VS Code with radian instead of the default R terminal, follow these steps:
- Install the VS Code R extension (if not already installed).
- Set radian as the R terminal in VS Code settings:
- Open VS Code settings (Ctrl+,).
- Search for r.rterm.linux.
- Set its value to the path of radian
Install R 4.5 or higher
Here are step-by-step instructions to upgrade R to version 4.5 or higher on Ubuntu 24.04:
Remove the old R version (optional):
sudo apt remove --purge r-base r-base-core r-recommended r-base-devInstall required dependencies:
sudo apt update
sudo apt install -y --no-install-recommends software-properties-common dirmngr gnupg apt-transport-https ca-certificatesAdd the CRAN GPG key:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 'E298A3A825C0D65DFD57CBB651716619E084DAB9'Add the CRAN repository for R (for Ubuntu 24.04 “Noble”):
echo "deb https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/" | sudo tee /etc/apt/sources.list.d/cran.listUpdate package list:
sudo apt updateInstall the latest R version:
sudo apt install -y r-baseVerify the R version:
R --versionThis should install R 4.5.x or newer.
Get around CRAN checks
Github pages publishing workflow
Prompts instruct the GitHub Agent
- When there are syntax errors that cannot be easily fixed, the issue seems often incomplete or fragmented code. Write clean versions instead, also, try to delete the version non-clean afterwards with the confirmation from me.
-