Using the latest version?
JFrog Platform User Guide


Skip to end of metadata
Go to start of metadata

Overview

From version 6.1,Artifactory natively supports CRAN repositories for the R language, giving you full control of your deployment and resolve process of CRAN packages. The Comprehensive R Archive Network (CRAN) is a collection of sites which carry identical material, consisting of R distributions, contributed extensions, R documentation, and binaries.R is a programming language and free software environment dedicated to statistical computing and graphics that is supported by the R Foundation for Statistical Computing.The R language is widely usedfor developing statistical software and data analysis bydata miners andstatisticians.

CRAN repositories in Artifactory offer the following benefits:

  • Secure and private local CRAN repositories with fine-grained access control.

  • The ability to proxy remote CRAN resources and cache downloaded CRAN packages to keep you independent of the network and the remote resource.

  • Virtual CRAN repositories that support a single URL through which to manage the resolution and deployment of all your CRAN packages.

  • Metadata calculation of the CRAN packages hosted in the Artifactory local repositories.

  • 版本管理:归档的旧版本e packages uploaded to local repositories.

  • Manage source and binaries.

Page Contents


Configuration

局部存储库

To enable calculation of CRAN metadata, selectCRANas thePackage Typewhen you create your local repository.

Local Repository Layout

You need tomaintain a specific path structurein order to manage the CRAN packages that are uploaded to CRAN local repositories.

CRAN packages are uploaded to the following locations:

  • Source packages are automatically uploaded by default to the relative path:src/contrib. For example:src/contrib/ArtifactoryRDS_0.1.0.tar.gz.
  • Binary packages are uploaded to a relative path according to the distribution and R version.For example:/myfirstpkg_1.2.tgz.

Artifactory will find your packages by performing a property search causing the folder hierarchy not to have an impact on performance.

Placing source packages in the recommended path

When uploading a CRAN package via the UI, the default deploy path is not enforced but is recommended since it allows Artifactory to manage the CRAN packages. Uploading the packages to a different path will cause the packages not to be identified as CRAN packages.

Remote Repositories

You can create CRAN remote repository to proxy and cache remote repositories or other Artifactory instances.

Note that the index files for remote CRAN repositories are stored and renewed according to theRetrieval Cache Periodsetting.


Virtual Repositories

A Virtual Repository in Artifactory aggregates packages from both local and remote repositories. This allows you to access both locally hosted CRAN packages and remote proxied CRAN libraries from a single URL defined for the virtual repository.

To create a virtual CRAN repository, setCRANas thePackage Type,and select the underlying local and remote CRAN repositories to include under theRepositoriessection.


Resolving CRAN Packages

Resolving CRAN Packages in the UI

When a CRAN repository is selected in the Artifacts module Tree Browser, clickSet Me Upto view the code snippets you can use to publish a CRAN package or to configure your R client to resolve artifacts using the selectedrepository.

Resolving CRAN Packages using the R Command Line

1. Run theSET ME UPfor CRAN.

2. To switch from the current repository to a different resolution CRANrepository.

setRepositories()

3. View all the available packages for the selected CRAN repository.

available.packages()

4. Install a package from the CRAN repository.

install.packages() - select from a list, on supported clients install.packages("package") - install by package name


Deploying CRAN Packages

You can deploy packages to a local or virtual CRAN repository using theDeployfeature in the UIor using a POST request.

Metadata Updates

The CRAN metadata is automatically calculated and updated when adding, removing, copying or moving CRAN packages. The calculation is only invoked after a package-related action is completed.
It may sometimes take up to 30 seconds to completeas the process is asynchronous and its performance depends on the overall system load.
You can also invoke metadata calculation on the entire repository by selectingReindex Packages.

设置默认的部署Repository

To deploy CRAN packages to a virtual CRAN repository, make sure you have set theDefault Deployment Repository.


Deploying a Package Using the UI

You can drag and drop, or select a CRAN package to upload in Deploy in the UI. Artifactory will identify if it's a source or binary package.

Artifactory supports two types of packages: binaries and sources. They are treated differently in terms of the deployment in the UI.

Deploying a Source Package

When deploying sources deploy, the Target Path is automatically displayed and we recommendnot changing this path.Changing the 'src/contrib' path will result in Artifactory not identifying the package as a CRAN package since Artifactory will not be able to index it.

Target Path

The Target path is automatically updated and changing it could make Artifactory not invoke the metadata calculation, and this package to not get indexed.

Deploying a Binary Package

In binary deploy, you'll need to fill the CRAN Artifact section.

In the CRAN Artifact section, configure these fields when deploying the CRAN packages. It is mandatory to set these fields and are used to create the destinationpath of the deployed binary package.

  • Distribution: Specifies the operating system.
  • R Version: Indicates theRversion used.

Target Path

The Target path is updatedafterthe file is deployed and there is no need to change it

Deploying a Package Using cURL

Deploy source package
curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/sources" -T package_1.0.tar.gz

Deploy binary package
curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/binaries?distribution=macosx/el-capitan&rVersion=3.5" -T package_1.0.tgz curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/binaries?distribution=windows&rVersion=3.5" -T package_1.0.zip

When deploying a CRAN binary package, you need to specify the distribution and R version as before.

When deploying directly (PUT request to a specific path), make sure the target path is a valid CRAN path:

  • /src/contribfor sources
  • /bin/{distribution}/contrib/{r-version}for binaries.

Deploying a package to a different path will not identify the package as CRAN packages, and will not invoke the metadata indexing.


Viewing Individual CRAN Package Information

Artifactory lets you view selected metadata of a CRAN package directly from the UI.

In theTree Browser,select your virtual CRAN repository and scroll down to find and select the package you want to inspect. The metadata is displayed in theCRAN Infotab.

Reindexing a CRAN Repository

You can trigger an asynchronous reindexing of a local CRAN repository either through the UI or using the REST API.

Through the UI, select your CRAN repository in the Tree Browser and select Recalculate Index from the right-click menu as shown below (requires Admin privileges)

To reindex a CRAN repository through the REST API, please refer toCalculate CRAN Repository Metadata.