ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
2 Day Countdown - The Alteryx Community will be temporarily unavailable for a few hours due to scheduled maintenance starting on Thursday, April 22nd at 5pm MDT. Please plan accordingly.

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

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

SeanL
Alteryx Alumni (Retired)
Created

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
SeanL
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. 

aguisande
13 - Pulsar
13 - Pulsar

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

suzb
6 - Meteoroid

I cannot access the tools referenced by the section entitled "Using the R Tool to Add Packages" in this post. They are not in a public place. Can they be moved (or copied) to a public location?

aguisande
13 - Pulsar
13 - Pulsar

Hi @suzb 

Which tools you are unable to access?

If they are related to gallery.alteryx.com, apparently they changed locations.

Just login into Alteryx Gallery and search them or browse the Predictive District (https://gallery.alteryx.com/#!districts/56327e37aa690a17f0760bdc)

 

I'll let Alteryx's people to fix the links.

Thanks for poiting this out.

Best

suzb
6 - Meteoroid

@aguisandeThanks! I have found that, when trying to use the package installer (after having found the Predictive District  😉   ) I have an R package dll issue. So I've contacted my sys admin support, per some advice I saw on this site.

aguisande
13 - Pulsar
13 - Pulsar

Anytime!

Glad you fix it!