R package for deploying models built using R to Alteryx Promote.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples README & Examples Updates (#10) Jun 28, 2018
man More detail in ref desciption. Nov 6, 2018
tests Cran (#5) Jan 22, 2018
.Rbuildignore Cran (#5) Jan 22, 2018
.gitignore Cran (#5) Jan 22, 2018
DESCRIPTION Updated date for submission to CRAN. Nov 7, 2018
README.md Updates and edits to README. Nov 9, 2018
howtorelease.r CRAN accepted branch as of 4/20/18 (#9) Jun 15, 2018
local_test_package.sh changes for cran Jan 22, 2018
promote-r-client.Rproj Updating rd files. Oct 31, 2018
promote.Rproj changes for cran Jan 22, 2018


Alteryx Promote R Client

Package for deploying R models to Alteryx Promote.


Hello World - A very simple model.

Lending - Use logistic regression to classify credit applications. as good or bad.

xgboost - Use xgboost to train a classifier on the agaricus dataset.



To install the promote package from CRAN, execute the following code from an active R session:


(Please refer to the promote-python package for instructions on installing the Python client.)

Promote App

Please refer to the installation guide for instructions on installing the full Promote application.

Using the Client

Model Directory Structure

├── deploy.R
└── promote.sh (optional)
  • deploy.R: our primary model deployment script

  • promote.sh: this file is executed before your model is built. It can be used to install low-level system packages such as Linux packages

Deploying Your Model

This section will walk through the steps and key functions of a successful deploy.r script.


Initial Setup

Load the promote library that was previously installed:


Import a saved model object:

# Previously saved model 'save(my_model, file = "my_model.rda")'


The model.predict function is used to define the API endpoint for a model and is executed each time a model is called. This is the core of the API endpoint




  • data the data frame generated from the JSON sent to the deployed model


model.predict <- function(data) {
  # generate predictions from the model based on the incoming dataframe
  predict(my_model, data)

Test Data

It is a good practice to test the model.predict function as part of the deployment script to make sure it successfully produces an output. Once deployed, the data argument passed to the model.predict function will always be in the form of an R data frame. The incoming JSON will be converted to a data frame using the fromJSON() method available from either jsonlite or rjson. Which library is used can be configured in the advanced model management section of the Promote App.


testdata <- '{"X1":[1,2,3],"X2":[4,5,6]}'



promote.library(name, src = "version", version = NULL, user = NULL, install = TRUE, auth_token = NULL, url = NULL, ref = "master")


  • name name of the package to be added
  • src source from which the package will be installed on Promote (CRAN (version) or git)
  • version version of the package to be added
  • user Github username associated with the package
  • install whether the package should also be installed into the model on the Promote server; this is typically set to False when the package has already been added to the Promote base image.
  • auth_token Personal access token string associated with a private package's repository (only works when src = 'github', recommended usage is to include PAT in the URL parameter while using src='git')
  • url A valid URL pointing to a remote hosted git repository (recommended)
  • ref The git branch, tag, or SHA of the package to be installed (SHA recommended)


Public Repositories:


promote.library(c("wesanderson", "stringr"))

promote.library("my_public_package", install = FALSE)

                src = "git", 
                url = "https://gitlab.com/userName/rpkg.git")


promote.library("cats", src = "github", user = "hilaryparker")

Private Repositories:

                src = "git", 
                url = "https://x-access-token:<YourToken>ATgithub.com/username/rpkg.git")

                 src = "git", 
                 url = "https://x-access-token:<YourToken>ATgitlab.com/username/rpkg.git", 
                 ref = "i2706b2a9f0c2f80f9c2a90ac4499a80280b3f8d")

                 src = "git", 
                 url = "https://x-access-token:<YourToken>ATgitlab.com/username/rpkg.git", 
                 ref = "staging")

promote.library("cats", src = "github", user = "hilaryparker", auth_token = "3HwjSeMu1ynrYtc1e4yj") 


Store custom metadata about a model as part of the model.predict call when it is sent to the Promote servers. (limited to 6 key-value pairs)


promote.metadata(name, value)


  • name the name of your metadata (limit 20 characters)
  • value a value for your metadata (will be converted to string and limited to 50 characters)


promote.metadata("one", 1)
promote.metadata("two", "2")
promote.metadata("list", list(a=1,b=2))


To deploy models, add a username, API key, and URL to the promote.config variable

  • username the username used to sign into the Promote app
  • apikey the random API key that is assigned to that username
  • env the URL that can be used to access the Promote app's frontend


promote.config <- c(
  username = "username",
  apikey = "apikey",
  env = "http://promote.company.com/"


The deploy function captures model.predict and the promote.sh file and sends them to the Promote servers


promote.deploy(model_name, confirm = TRUE, custom_image = NULL)


  • model_name the name of the model to deploy to Alteryx Promote
  • confirm if true, the user will be prompted to confirm deployment
  • custom_image the custom image tag to use when building the model


promote.deploy("MyFirstRModel", confirm = TRUE, custom_image = NULL)


The promote.sh file can be included in your model directory. It is executed before your model is built and can be used to install low-level system packages such as Linux packages and other dependencies. Be aware of the current working directory for your R session when deploying to ensure the deployment finds and processes the promote.sh file.


# Install Microsoft SQL Server RHEL7 ODBC Driver
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo

yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts
ACCEPT_EULA=Y yum install msodbcsql17
# optional: for bcp and sqlcmd
ACCEPT_EULA=Y yum install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc


There are multiple ways to run your deploy.R script and deploy your model.

  1. In in an active R shell session, you can source the deploy.R file.
  1. If in a console/terminal/bash session, you can use the Rscript utility to run the file.
Rscript deploy.R
  1. If using an R IDE environment like RStudio, you can run or source the script all at once or selectively. Model deployment will once the promote.deploy function is called.