- Obtaining R Packages - Aster R

Teradata Aster® R User GuideUpdate 3

Aster R
December 2017
Programming Reference
User Guide
If the Aster cluster does not have direct Internet access, R packages must be downloaded from the Internet to a separate machine and then copied to the queen node of the Aster cluster. There are several options to perform this task.
  • Download R packages from the CRAN website at https://cran.r-project.org. This is the most common source for R packages and documentation.

    When downloading R packages manually from the CRAN website, follow the steps below to make sure that all dependencies are downloaded as well.

    Go to the CRAN website, navigate to packages and then to Table of available packages, sorted by name. When the user click on a package name, a screen appears with links to all of the package documentation, including a list of required R package dependencies (on the line “Imports”, as shown here).

  • Another method is to write an R script that connects to CRAN, queries the R package repository, resolves package dependency issues, and then downloads all the required R packages to a local folder. An example script is shown below. Note that this script does not provide the required ordering of packages when inputting more than one package at a time into the "target" object.
    ### Step 1: Change this to create initial package list. Enter package names between quotes 
    # separate package names with commas and be careful with punctuation
    targets <- c("r_packagename_1", " r_packagename_2")  
    ### Step 2: Change Folder variable to enter destination file directory  
    # Please note that with R the direction of the slash is the reverse of the Windows norm
    # Windows uses backward slash "C:\Users\..." while R uses forward slash "C:/Users/..." 
    folder <- "C:/Documents/Aster/Installation/R/packages" 
    ### Step 3:  Establish function
    getPackages <- function(packs){  
    	packages <- unlist(    
    		tools::package_dependencies(packs, available.packages(),      
    			which=c("Depends", "Imports" , "LinkingTo" ), recursive=TRUE)  
    	packages <- union(packs, packages)  
    packages <- getPackages(targets) 
    ### Step 4: Execute function 
    download.packages(packages, destdir=folder,type="source") 
In almost all cases, the R packages required by Aster are the same as the ones installed in a Windows installation of R. R packages downloaded from CRAN have a tar.gz extension. R packages downloaded from other sources will probably have a .zip extension. Linux-oriented .rpm files are not used with Aster R.