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

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Additional installed R packages

cpanfil
7 - Meteor

Do additional installed R packages, installed in our private gallery, persist through an upgrade?

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

Additional R packages are loaded to your private library (by default):

 

# Obtain the string of the package(s) to download
pkgs <- '%Question.packages%'
pkg2 <- trim.blanks(unlist(strsplit(pkgs, "\\,")))
if (length(pkg2) > 1) {
  pkgs <- eval(parse(text = paste0("c('", paste(pkg2, collapse = "','"), "')")))
}

# Obtain the user specified directory (which may not be used)
custom_path <- scan(what = character(), sep = "\n", nmax = 1)
%Question.custom.path%

# The set of possible repositories to use
repos <- c("http://cran.revolutionanalytics.com", "http://cran.rstudio.com")
# Select a particular repository
repo <- sample(repos, 1)

# Get the path to the library folder, starting with the default case, then the
# custom case
if ('%Question.default.dir%' == "True") {
  minor_ver <- strsplit(R.Version()$minor, "\\.")[[1]][1]
  R_ver <- paste(R.Version()$major, minor_ver, sep = ".")
  the_path <- paste0(normalizePath("~"), "\\R\\win-library\\", R_ver)
  # Create the user's personal folder if it doesn't already exist
  dir.create(the_path, recursive = TRUE, showWarnings = FALSE)
} else {
  the_path <- gsub("\\\\", "/", custom_path, fixed = TRUE)
}
print(the_path)

# Install the package to the user's private library
transcript <- capture.output(install.packages(pkgs, lib = the_path, repos = repo))

# Write out the results of trying to install the package(s)
write.Alteryx(data.frame(Transcript = transcript))

What I've experienced is that if the library already exists, that you'll need to either DELETE  or RENAME the Alteryx provided package (e.g. when you want a newer version).  When you upgrade, you might have a need to modify the contents of the upgrade libraries.

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
cpanfil
7 - Meteor

I'm not sure I fully understand.  This is the part I'm worried about, "When you upgrade, you might have a need to modify the contents of the upgrade libraries."

 

So when I install a completely new package, salesforcer for example.  When I upgrade Alteryx server, is the salesforcer package maintained in the default directory (c:\program files\alteryx\R-3.4.4\library), or will it need to be installed again after the upgrade?

cpanfil
7 - Meteor

Any other insight?  Again, I'm just looking to see if newly installed R packages on to our private gallery, do not get overwritten during an upgrade.  Thanks!

cpanfil
7 - Meteor

Recently upgraded our DEV environment to 2019.1 and the R packages that we installed prior to upgrade were all still present in the /library folder.