0

I have created a custom package and would like to deploy it to a remote machine. Here is my current long workflow:

  • Create custom package 'my_package_0.1.0.tar.gz'
  • scp package to remote machine
  • create Remote session
  • install.packages("/path/to/my_package0.1.0.tar.gz")
  • library('my_package')

When others connect to the machine, they have to run install and library:

  • install.packages("/path/to/my_package0.1.0.tar.gz")
  • library('my_package')

Is there a way I can share a custom package and have the workflow be:

  • Create remote session
  • Load package with library('my_package')
Brig
  • 10,211
  • 12
  • 47
  • 71
  • You don't have administrative access to the remote machine? In which case you could install the package system-wide. – neilfws May 01 '17 at 22:27
  • This may also be of some help: http://stackoverflow.com/questions/3487329/installing-r-packages-available-for-all-users – Ian Wesley May 01 '17 at 22:28
  • An alternative might be to keep your package as a script, and upload it online e.g., to github. That way, users can simply source your script from github, and it will be always up to date. – thc May 01 '17 at 23:47
  • It looks like remote connections store files in a location like /opt/deployr/9.0.1/rserve/workdir/Rserv8.0.5/connXXX. Where is a more appropriate location for shared files? – Brig May 02 '17 at 14:58

1 Answers1

0

Feedback in comments says the best practice is to install the package in a shared location.

Here is how you can find a good place to install the packages.

Running the following shows where libraries are loaded from

.libPaths()
# rserve2 rserve2 /opt/deployr/9.0.1/rserve/R
#root root        /usr/lib64/microsoft-r/3.3/lib64/R/library

There are two locations the R server is looking for libraries. One is owned by root so we shouldn't deploy here. The other location rserve2 has owndership and looks promising. We should create a library subfolder to store the shared packages.

Based on this information, the work flow should be:

  • Create custom package 'my_package_0.1.0.tar.gz'
  • scp package to remote machine
  • create Remote session
  • install.packages("/path/to/my_package0.1.0.tar.gz", lib='/opt/deployr/9.0.1/rserve/R/library/')
  • library('my_package')

When others connect to the machine, they can load the shared library:

  • library('my_package')
Brig
  • 10,211
  • 12
  • 47
  • 71