community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Knowledge Base

Definitive answers from Designer experts.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

R Packages in the R Tool

Community Content Engineer
Community Content Engineer
Created on

R is an open-source programming language and software environment, specifically intended for statistical computing and graphics. The Alteryx Predictive Tools install includes an installation of R, along with a set of R Packages used by the Predictive Tools.

 

Packages are user-created collections of R functions, data and compiled code. R packages are an easy way to share and implement different statistical techniques and other functions in R, and a large part of what makes R so popular and robust.

 

The directory where the packages are stored is called the library. One instance of R can have multiple libraries associated with it. The R function .libPaths() returns the file paths of any libraries associated with the current R session.

 

If you’ve ever wondered what R packages are installed on your machine in association with R, I have developed a little bit of code that you can put into your R Tool and run. The output will be a list of the installed R packages and a description of each of their uses.

 

#get general information about R version
version <- R.Version()[13:14]

#extract package name and version
packages <- as.data.frame(installed.packages(lib.loc = .libPaths())[,c("Package", "Version")])

#remove row names
rownames(packages) <- NULL

#extract description
packages$Description <- unlist(lapply(lapply(packages$Package, packageDescription), "[[", "Title"))

 

This code first extracts the version information of the R session, then it accesses the package and version information for all installed packages with the installed.packages function, and converts the output to a data frame. After extracting the packages and version information, the rownames of the dataframe are removed by setting the row names to NULL. Finally, an associated package description is attached for each installed package.

 

In the attached workflow, I have pasted this code into an R Tool, along with write.Alteryx functions to write all of this information out into a data stream.

 

#write out to datastream 

#packages
write.Alteryx(packages, 1)

#version info
write.Alteryx(version, 2)

 

This information can help you with package management and version control. Occasionally, having mismatching R or R-package versions between where code is developed and where the code is executed (e.g., the R Tool) can cause unexpected behavior.

 

In addition to a bunch of open-source packages from various authors, there are a handful of Alteryx R packages that are installed with the Predictive Tools. The github repository for these packages can be found at https://github.com/alteryx

 

There are six Alteryx-specific R packages on this repository that are important to highlight:

 

  • flightdeck – flightdeck is an R package designed to make the creation of interactive dashboards for predictive models easy. This is the package that is used to create the “I” outputs in some of the predictive tools. 
  • jeeves – jeeves is a helper package (described as a sagacious valet) used to assist with developing and maintaining the predictive models in Alteryx.
  • promote-r-client – The promote R package is used to assist with the deployment of R-based predictive models to a Promote instance.
  • AlteryxRViz – AlteryxRViz includes functions that drive interactive visualizations for many of the predictive tools in Alteryx. 
  • AlteryxPredictive – AlteryxPredictive contains utility functions used by the predictive tools in Alteryx.
  • AlteryxPrescriptive – The AlteryxPerscriptive package includes the code for the Simulation and Optimization tools in Alteryx.

 

Attachments
Comments
Moderator
Moderator

Great post @SydneyF!!

 

Also, I have found the following columns -provided by installed.packages()- helpful when investigating packages issues:

 

LibPath: location of the library on the machine

Depends: dependencies (R version, other libraries,...)

Imports: packages used but not attached (like calls involving "::" or ":::" for instance)

Built: version of R used to build the package

 

Source: https://cran.r-project.org/doc/manuals/r-release/R-exts.html

 

Example:

 

write.Alteryx(as.data.frame(installed.packages()[,c("Package","Version","LibPath","Depends","Imports","Built")]),1)

 

0aHAYnu[1].png

 

Thanks,

 

PaulN