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

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Use Case: Using Additional R Packages: Times Series Clustering Example

Alteryx Alumni (Retired)
Created on

 Alteryx has a full set of integrated predictive tools but even with developers working at full speed, it is hard to keep up with the R community. Sometimes users want to install and utilize their favorite R packages. Luckily, there is a solution for advanced users. This post will:

 

  • Show how to install/load an R package that is not already included with the Predictive Tools
  • Present an example of time series clustering using the R package "TSclust". (See the attached workflow, developed in v10.0)

 

 

Using an Additional R Package:

 

Can you adapt your code to use the integrated packages? This is the first thing to consider because using the existing packages gives you easier integration with the rest of the workflow and better compatibility. Here’s the list of included packages in Alteryx 10.1: Alteryx R Packages.

If you must use additional R packages, the best approach is to use the analytic app attached below to add the package in your local R library. Please note that there are two limitations here:

  • Even if you use additional R packages, Alteryx does not support showing GUI elements from these packages.
  • Apps running on the Alteryx Gallery will not support these additional packages.

 

If you still would like the package to be part of Alteryx Product, please post this request to the Ideas section of the community or star the post if someone else already asked for it.

  

Using the R Tool to Add Packages

If you would like to incorporate an additional R package, the Install R Packages analytic app available in the Predictive District does just that:

 

 installer_config.PNG

 

 

Simply change the package name to the one you would like to test out. Change the configuration options to suit your requirements, and then click "Finish."

 

A cautionary note: As of the time of this writing (May 2016, newest version of Designer is 10.5), it's important to ensure that you only install packages that do not come with the Alteryx Predictive tools installation. You may end up installing a different version of a package that is used with the Predictive tools, and the conflicting versions can cause errors in these tools. We are currently working on an improvement that will solve this problem. The improvement should be available with the 10.6 Predictive release.

 

 

Use Case Example: Time Series Clustering

Alteryx implements many clustering algorithms. But what if the data you would like to cluster is a time series? For example, customer sales histories? Or sales histories at different locations? In this example we have booking data from different years. We would like to group the years based on two characteristics of the time series:

  • Magnitude: years with high total and average booking volume should be considered similar.
  • Temporal Patterns: for example, if in 2000 and 2002  sales were higher in the summer but lower in the winter, and then in 2001 and 2003 the trend was reversed, we want to group 2000 and 2002 together and 2001 and 2003 together.

We will accomplish this using the TSclust package, whose documentation is available online. The attached workflow demonstrates the process, with the following results:

 

TSclust_example.PNG

 

For this data set, the grouping was mostly a function of magnitude, because most of the years had similar temporal patterns.  

 

Acknowledgments:

Check out the original discussion page (and authors who contributed R code!): 

Leveraging R packages not installed in the custom R Alteryx

Attachments
Comments
Alteryx Alumni (Retired)

To further clarify when it is necessary to reach out to Client Services (Option 1) vs using the boilerplate code (Option 2).  The original context of the article was for users creating apps to be posted on the Alteryx Gallery. For users who are working in Alteryx Designer, Option 2 is considered best practice. 

Alteryx Certified Partner
Alteryx Certified Partner

Hi,

No matter which package I try to get with this method, I'm receiving "Error: R (8): Error in available[p1, dependencies, drop = FALSE] : "

Even with the sample workflow attached to the post.

 

Can you point me in the right direction to make this work? 

 

Thanks a lot

 

PS: I'm using V10.5 w/3.2.3 X64