'RStudio install packages from Azure DevOps

I'm creating some internal packages with R in RStudio. My repositories are hosted in Azure DevOps. I saw the renv.lock and there is a section for repositories.

{
  "R": {
    "Version": "3.6.1",
    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://cran.rstudio.com"
      }
    ]
  },
  "Packages": {
    "BH": {
      "Package": "BH",
      "Version": "1.69.0-1",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "0fde015f5153e51df44981da0767f522"
    },
    "KernSmooth": {
      "Package": "KernSmooth",
      "Version": "2.23-16",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "a531dc333440009ee13bbb507232476d"
    }
}

My components are in a url like

https://dev.azure.com/mycompany/RComponents/_git/mycomponent

Is there a way to add my private repositories in here? How can I install R packages from Azure DevOps?



Solution 1:[1]

renv is able to install and restore packages from a variety of sources, including:

  • CRAN,
  • Bioconductor,
  • GitHub
  • Gitlab
  • Bitbucket

However, it does not include Azure DevOps. Please refer to this document. In addition, there is also no information about using Azure DevOps repositories or packages in the RStudio Documentation.

Solution 2:[2]

I got it to work using the remotes package!

remotes::install_git("<clone url>", git = "external")

#AKA
remotes::install_git("https://[email protected]/USER/PROJECT/_git/NAME", git = "external")

You are then directed to a sign in handled via RStudio popups.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Lu-MSFT
Solution 2 Brandon Rose