Select the library using rxInstallPackages RRS feed

  • Question

  • install.packages("dplyr", dependencies = TRUE, lib = "C:/Program Files/Microsoft/R Client/R_SERVER/library") can be used to install a R package on R Client. Lib= allows you to select the library that is used by all users.

    When you don’t have an Internet connection, on a SQL server, rxInstallPackages can be used to install R packages using RGui on a desktop, with a connection to the Internet. It can install packages on a SQL Server, with R services, that has no Internet connection.

    Is it possible to select the library you want to update using rxInstallPackages? Like adding lib= to install.packages(). To install the packages in C:/SQL/MSSQL13.DWH/R_SERVICES/library/ or another location that has been set during the installation of R Services.

    Friday, August 9, 2019 2:16 PM

All replies

  • The rxInstallPackages() does not take a 'lib' argument.  What you can do is to set the library path to install to using '.libPaths() function:



    Monday, August 12, 2019 5:14 PM
  • Steve, Thanx for your reply.

    When I add your reply to the script I am using I get:

    sqlCCConnString <- "Driver=SQL Server;
    sqlCC <- RxInSqlServer(connectionString = sqlCCConnString, numTasks = 1)
    pkgs <- c("tranSurv")
    .libPaths("E:/Program Files/Microsoft/ML Server/R_SERVER/library")
    rxInstallPackages(pkgs = pkgs, verbose = TRUE, scope = "shared", computeContext = sqlCC)

    Is that ok, or should I remove scope ="shared"?

    Tuesday, August 13, 2019 8:36 AM
  • Setting 'scope' equal to 'shared' creates a library that is associated with a SQL Server instance and that can be referenced by multiple different SQL Server users(accounts).

    If you want to share your libraries amongst different user accounts for SQL Server, then you want to select scope='shared'. The default is 'private' associated with a single database/user.

    Tuesday, August 13, 2019 6:44 PM
  • .libPaths("E:/Program Files/Microsoft/ML Server/R_SERVER/library") has no effect.

    Probably because .libPaths requests a change of the library path on the local session? And not for the remote session that rxInstallPackages starts.

    • Edited by Erik Verheuvel Wednesday, August 14, 2019 9:02 AM font to small
    Wednesday, August 14, 2019 9:00 AM