Skip to content

Preventing loading of user packages

5 messages · Jonathon Love, Ista Zahn, David Winsemius +1 more

#
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

I'm trying to prevent the loading of packages from the 'personal
library' on an OS X machine. i.e. the packages that are normally
placed somewhere like:

~/Library/R/3.0/library

There is a file in the R.framwork directory:

/Versions/3.0/Resources/etc/Renviron

which contains a line:

R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.0/library'}

but commenting this out does not prevent R from loading from that
location.

is there a way to prevent loading from that location?

with thanks

jonathon

- -- 

JASP - A Fresh Way to Do Statistics
http://jasp-stats.org/

- --

How happy is he born and taught,
That serveth not another's will;
Whose armour is his honest thought,
And simple truth his utmost skill

This man is freed from servile bands
Of hope to rise, or fear to fall:
Lord of himself, though not of lands,
And, having nothing, yet hath all.

  -- Sir Henry Wotton





-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJT+wi9AAoJEH277gjmPGDYzkkP/0rA4bwVK9+E7Y9S2f/8+mpY
QTgGS8Q19YfFd9ZgQICM+Zb9s+cZiC60EwC8IBlBpf2fMGioKFtv8fGFrTKOFpOl
8H758D/HdkvzwpQ/XCDP+sNQQ3VNxryoKzgXV7O5vusKjnfRO8nmpldjqURnIoze
LUvUYgp3ySK3JfjZwBlpcGzahnhl95KBWQzpW2cXSJH0SaJ9jzfO6OHVEZPmJaVi
llePJqJJ36ZlI1XUt9XZIySfsw7o1efcjLNdFq2UYFExEI17bqa3DihuXRAzBBSF
1sWPQGmTGAn6N9MT7EJ7UxBiSMTvnbO/fjKNxjRGk+p89h+bmrdVmnn408QGkIe/
d+os4++sG9nLVywLduJ/tCemMfWjRVDBCwlCbTrRbehi95UqX3UF5K6a2Iq7FMV7
3Y4oan2DcRdFzNClLIkDbNVYTPz08fsr3xhTNgfXr1ewhaF6ZPqp0WOBk1yMOw8D
6Gy/T/xy295jx4KeMsYL+bJz69xOrfb0+1tbdy4PeFHU2VzF2GauGjhVSGI5AV/b
WETcfCEGuSqCiJQJQTuZpq4efQDQUGh3dhhelzFZ7CNJuHXzRIeW6OCgylaUhvl6
rG5hr/wIcx4jctiu/8ho0GnaV7UFgPBt5PmJtpZeSXYoLUJD0o0TdJ4X2dJX2cMC
yBw4k89c84TcSQcwoxSf
=hnwc
-----END PGP SIGNATURE-----
#
On Mon, Aug 25, 2014 at 5:58 AM, Jonathon Love <jon at thon.cc> wrote:
Of behalf of the users you are about to cripple, please, do not do that!

-Ista

on an OS X machine. i.e. the packages that are normally
#
On Aug 25, 2014, at 7:11 AM, Ista Zahn wrote:

            
Hello jonathon and Ista;

(I think this might be the first time I've seriously with Ista.) I've been in the situation where I had multiple copies of packages in 2 different libraries and wanted to do exactly what was requested. I'm assuming that the "main" library directory is something other than '~/Library/R/3.0/library' and permissions allow packages to be accessed and placed there. A quick method would simply be to execute this at the command line (or if it needed to be repeated in .Rprofile) :

.libPaths( .libPaths()[!which(.libPaths() == '~/Library/R/3.0/library')] )

I suppose you could wrap some testing around this to prevent the removal of that path if it were the only one or if it were the path to the base and stats packages. Fo me this reports correctly that my base package is not there:
[1] FALSE

But this raises the question. Why is this happening and why don't you just delete the directory?
#
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

hey,

i was able to solve the problem by explicitly putting

R_LIBS_USER=''

in the /etc/Renviron file (it isn't enough simply to comment the entry
out, because it has a default value that magically comes from
somewhere else)

cheers
On 25/08/2014 9:59 pm, David Winsemius wrote:
- -- 

JASP - A Fresh Way to Do Statistics
http://jasp-stats.org/

- --

How happy is he born and taught,
That serveth not another's will;
Whose armour is his honest thought,
And simple truth his utmost skill

This man is freed from servile bands
Of hope to rise, or fear to fall:
Lord of himself, though not of lands,
And, having nothing, yet hath all.

  -- Sir Henry Wotton





-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJT+6XIAAoJEH277gjmPGDYU8sP/1zd8KOdkCfP0RMvuuD/H8vm
nfyByHbTIPrSc/ERWYm8aoc1UAFO95U6tjxdPQzsVXli00RgRLpr9aa58HXsr8TI
i+2P5Hrq/b7nXG6rUIjN6YBoKW/cuYmujQhecvcD2VyLAGqAbSnRMq/9XSk2ghba
fIKsOgMj+VqVEiBjb2bpeq0UeGl0JmPzQ29s7A+ncKX7L9rDrPCV9Rf2wG205dIl
wZftqilwcwvKmIidnc//WMSZawNWUZZKmfxui+u1RqjkqgP9sNbtS8dsAHzZo/gY
N+BNBmZ7uQa7ewLkGUU0/gmAzPaAYUNfidMhEFhzXrpR1ncEAcdwgV/FKtJIOuij
ngttf2AsbB779S0cLz+I2uwxcUPh1WqJXAGWNHk+xDmyA/eUZIqxrPHtathDohJb
Z0IU7+ld2gI2qo/OGp4m47HktHOM1ky+bgGPQnE5CCgM4XxavIhgWvzXW9tq4nVo
YQEjGzhRW4WMTdpaF0DgjneNeYVUjtWy6uckdn4L3nP87qgPJSUwByWWZpzjEBjZ
WAvyIK8VAVgIQKeegN9Rr82Uw1JZXvnueTHE5sH/Mwur4T1wxl9CaHE2cDi2BnMJ
n1MCbPMp2rS+Zae7lJAhmXCM9P3wTtOfQVw5LyaXWIC4VF6MhZVVyFW7uWD0Z1pJ
h0GN6g/DUUImGhve9Oqs
=IjO5
-----END PGP SIGNATURE-----
#
On 8/25/2014 2:08 PM, Jonathon Love wrote:
It is worth pointing out that what you have done is removed the personal 
library from the default list of libraries. So when loading a library, 
it won't be found in a (the) personal library. However, a user can 
circumvent this easily if they wish, either by adding a directory to the 
library path list via .libPaths() or by specifying lib.loc in a call to 
library() (or a variety of other ways). In other words, a user can still 
"load[...] user packages" with a little additional effort. For your use 
case, this may be sufficient. But I didn't want you to have the 
impression that this made it impossible to load additional packages.