Skip to content
Snippets Groups Projects
github.Rmd 1.63 KiB
title: 'R.1: Installing packages from github'
author: "Carine Rey [carine.rey@ens-lyon.fr](mailto:carine.rey@ens-lyon.fr), Laurent Modolo [laurent.modolo@ens-lyon.fr](mailto:laurent.modolo@ens-lyon.fr)"
date: "2021"
output:
  rmdformats::downcute:
    self_contain: true
    use_bookdown: true
    default_style: "dark"
    lightbox: true
    css: "../src/style.css"
rm(list=ls())
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(comment = NA)
klippy::klippy(
  position = c('top', 'right'),
  color = "white",
  tooltip_message = 'Click to copy',
  tooltip_success = 'Copied !')

If you need to install a package that is not available on the CRAN but on a github repository, you can do it using the "remotes" package. Indeed this package imports functions that will allow you to install a package available on github or bitbucket or gitlab directly on your computer.

To use the "remotes" packages, you must first install it:

install.packages("remotes")

Once "remotes" is installed, you will be able to install all R package from github or from their URL.

For example, if you want to install the last version of a "gganimate", which allow you to animate ggplot2 graphes, you can use :

remotes::install_github("thomasp85/gganimate")

By default the latest version of the package is installed, if you want a given version you can specify it :

remotes::install_github("thomasp85/gganimate@v1.0.7")

You can find more information in the documentation of remotes : https://remotes.r-lib.org