Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

R package updates and loading

creily
8 - Asteroid

New Alteryx user here,

I am testing if Alteryx can used for genetic analysis, and am attempting to use an R package within it that performs specific data normalization processes. The R package (Seurat) installs fine, but when I try and load it, library(Seurat), it returns an error:

 

Error: package 'Matrix' 1.2.12 was found, but >= 1.2.14 is required by 'Seurat'

 

The 'Matrix' package installed on Alteryx is 1.2.12 (I looked in the Alteryx file), when I attempt to update it using the R Install tool, it does not update it to 1.2.14 or higher, however, I get no error or warning codes when I do install.

 

I the tried to do a simple install call instead (install.packages("Matrix", repos = "http://cran.studio.com")). With this approach I get a warning saying:

 

package 'Matrix' is not available (for R version 3.4.4)

 

I did query for the R version in Alteryx, and it is 3.4.4. Based on the description from CRAN directory for Matrix, this R version should support this version of Matrix. As a side note, I do have R studio and R installed on my computer.

8 REPLIES 8
BenMoss
ACE Emeritus
ACE Emeritus
Could you use .libpaths() to change the library directory to point at your RStudio library and see if you can successfully load the packed from here; I imagine not but worth a try.

And as a heads up, when I'm installing r packages I will go to c program files Alteryx r bin and then there is a r.exe, right click on this and got run as administrator, then type in your install.packages command, it will prompt you to pick a cran mirror and you will see any install issues you may have.

Ben
creily
8 - Asteroid

I keep getting a error when changing the .libpaths() to the R folder that is outside the Alteryx one. Here is the code I have in the R Alteryx module- .libpaths(C:\user\username\Documents\R)

 

Error: unexpected input in "libpaths(C:\"

Execution halted

The R.exe exit code (1) indicated a error

 

The R folder that is not in alteryx does have the updated Matrix though!

BenMoss
ACE Emeritus
ACE Emeritus
When using paths in R you must either escape backslashes so \\ instead of \ or swap them for forward slashes /

Ben
creily
8 - Asteroid

Fixed that problem, thanks, but then ran into another! Currently using

.libpaths("C:/Users/username/Documents/R")

 

Error in .libpaths("C:/Users/username/Documents/R"):

could not find function ".libpaths"

 

Do I need to load basic functions before trying to add scripts in Alteryx R?

DavidxL
9 - Comet

It's the capitalization. Try           .libPaths()        [capital P]

 

If there are any packages already loaded by Alteryx and you want to load a newer version in your personal R library, you'll also run into an error.

creily
8 - Asteroid

Thanks, it did require capitalization, and I did get an error. Not sure how to get around this whole problem. Can I delete files in the Alteryx R lib set, and replace with a separate one?

DavidxL
9 - Comet

I haven't personally tried that yet so I'm also interested to see how it turns out for you. There is a risk that updating one of those packages might break some Predictive Tool macro, so I would make sure to make a backup first before trying to update a package as @BenMoss suggested.

 

When I ran into a similar issue I opted to run my R script using the command tool instead because there were too many dependencies that required updating.

creily
8 - Asteroid

The Seurat package loaded without a problem! So I guess you can swap out the R package files for a different version. Have not tested other tool functionalities that may use the Matrix package, but so far so good. Thanks for the help everyone!

Labels