Installing R Packages, both on Alteryx Designer and on an Alteryx Server
There’s a few resources out there which describe different ways of installing R libraries to your computer. I’m adding another, and this is the method that I suggest to our clients to use, but first an important note, you will need Admin rights to use this technique.
Installing for Alteryx Designer
For Alteryx Designer users, navigate to the following file path…
*The R version may change, so R-3.4.4 may not always be the correct sub-folder, in fact the path should be seen as…
Find the following file ‘R.exe’ (if you have file extensions hidden, this will just be ‘R’.
Right click on this executable file and hit ‘Run as administrator’.
You may get a windows prompt asking if you want to allow this app to make changes, hit ‘Yes’.
Now you are going to look like a maverick to any non-IT people that may be gazing at your screen.
Type in the command ‘install.packages(“PackageName”), once you have written your command, hit enter (note the R terminal is case sensitive!).
In this instance I am looking to install the readxl package.
Once you hit enter, a prompt will appear, asking you to select a ‘CRAN mirror’; this is essentially an online repository for where the R packages are held; so important note, this will not work when you are not connected to the internet. I tend to select the one closest to where I am; though it shouldn’t matter to much.
One thing to be mindful is if the installation fails, one thing to try would be to select a different mirror, which can be done by closing the console and going back to step 1.
It’s also important to note that if this prompt does not appear, it is likely that you are not running the console as an administrator, as outlined in the step above.
Once you have selected your ‘CRAN mirror’ from the prompt, the R terminal will begin processing the download and unpacking of the library and all dependent library packages.
With all the libraries, we want to see the message ‘successfully unpacked and MD5 sums checked’; if you see any messages that suggest an error in the installation, then it will be worth restarting the process again.
Once the process is complete, then you should be able to find your library in the following directory…
C:\Program Files\Alteryx\R-VERSIONNUMBER\library (to be politically correct)
And in Alteryx I can use the package, simply by bringing an R tool onto the canvas and inserting the code
Installing for Alteryx Server
The process is actually identical. But you will need credentials in order to remote into an administrator account on the server machine, which you will be able to get from the Alteryx Server Administrator (note, they will probably ask you for the package name, so they can perform the process themselves, just so they can control and monitor the process and be aware of anything that is being installed onto the server machine, which is fair; if they are unsure how to do the process, just send them this post!).
Once they have done that, any workflow you publish to your companies gallery should work just as it does in designer!