Installing CRAN packages - Latest

Data360 Analyze Server Help

Product type
Software
Portfolio
Verify
Product family
Data360
Product
Data360 Analyze
Version
Latest
Language
English
Product name
Data360 Analyze
Title
Data360 Analyze Server Help
Copyright
2024
First publish date
2016
Last updated
2024-11-28
Published on
2024-11-28T15:26:57.181000

The easiest way to install open source R packages is by using the R Library Package Download node. The R Library Package Download node automates the process of downloading and installing the set of libraries that are prerequisites for the operation of the nodes in the Statistical and Predictive Analytics node pack (for example, the Market Basket Analysis node and Quantile Regression node).

If you do not have access to the R Library Package Download node, or if you want to install additional packages, you can download and install open source R packages from "The Comprehensive R Archive Network" (CRAN).

Precisely repository

Due to the nature of the official CRAN updates and potential incompatibility issues, Precisely hosts our own repository with tried and tested versions of the packages. We only host those packages known to be compatible with the Statistical and Predictive Analytics node pack (powered by TIBCO®). If you want to install other packages, this must be done on the understanding that the latest versions may not be compatible.

See also:

Installing packages on Windows

You can install CRAN library packages using an R script within the Power R node.

The procedure is the same as that when installing a package in the R console, that is, using the R language install.packages() function. You can install the binary packages directly from CRAN.

The following is an example of the Power R node configured to install a package (in this case "Matrix" from the Precisely CRAN site).

Copy the following RScript and paste it into the Power R RScript property.

Note: If you want to view the "check if package "Matrix" is installed", then you must add the output pin out1 to the node.

## Setup additional library pathmyLibrary = "{{%ls.tempDir%}}/TERR/libs" # Version/platform independent.libPaths( c( .libPaths(), myLibrary) )## Set the working directorysetwd("{{%ls.tempDir%}}")## Set the script to use the CRAN repositoryRepos = getOption("repos")#For the Statistical and Predictive Analytics node pack packages use the Precisely repositoryRepos["CRAN"] = "http://cran.lavastorm.com"#Repos["CRAN"] = "http://cran.us.r-project.org" #The default CRAN#Repos["CRAN"] = "http://lib.stat.cmu.edu/R/CRAN" # Specify a particular mirroroptions(repos = Repos)## Function to check whether package is installedis.installed <- function(mypkg){is.element(mypkg, installed.packages()[,1])}## Get the platform OS typeOStype <- .Platform$OS.type# check if package "Matrix" is installedif (OStype == "windows" & !is.installed("Matrix")){install.packages("Matrix", type="win.binary", myLibrary)}## Remove the Repos variablerm(Repos)########################################out1 <- data.frame(Installed=is.installed("Matrix"))

When run, the node will download and install the package into the specified library location and outputs an indication on whether the library is installed after the installation process has completed. The package is only downloaded and installed if it is not already present on the machine. Internet access is required and the node will only attempt to install the package if it is run on a Windows machine.

Installing packages on Linux

As CRAN packages for Linux are typically distributed as source packages, the Linux server must be provisioned with system libraries that permit the compilation of the prerequisite CRAN packages, including:

  • gcc43
  • gcc43-fortran
  • libgfortran43

To install packages on a Linux platform you must install the open source R product, as described at: https://www.r-project.org/. Once the application has been installed the install.packages() routine is used.

The minimum version of R required by the Precisely repository is R 3.3.2. It is recommended that users of the Statistical and Predictive Analytics node pack install all available archive packages on the Precisely repository.

The following example R script is configured to install the packages used by the Statistical and Predictive Analytics node pack and points to the Precisely repository.

install.packages(c("arules","binomTools","boot","cluster","lattice","Matrix","NbClust","quantreg","randomForest","SparseM","survival","TTR","xts","zoo"),destdir="/opt/lavastorm/LAE6.1/tmp/TERR/downloads",contriburl="http://cran.lavastorm.com/src/contrib",type="source",lib="/opt/lavastorm/precisely/tmp/TERR/libs", method="libcurl")

When run, the application will download and install the package into the specified library location - /opt/lavastorm/precisely/tmp/TERR/libs in this case.

For a full list of the Precisely repository packages, see: http://cran.lavastorm.com/src/contrib/PACKAGES

CAUTION:
For any other packages, you are advised to use an official CRAN repository. Precisely cannot accept any responsibility for incompatible packages from a CRAN repository that we do not host.