[Rd] [patch] giving library() a 'version' argument

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 12 14:53:59 CEST 2012


A very important point is that library() *had* a 'version' argument for 
several years, and this is not what it did.  So Mr Williams needs to do 
his homework ....

 From such a version of R:


  version: A character string denoting a version number of the package
           to be loaded, for use with _versioned installs_: see the
           section later in this document.
...

On 12/04/2012 13:21, Duncan Murdoch wrote:
> On 12-04-11 11:28 AM, Ken Williams wrote:
>> I've made a small enhancement to R that would help developers better
>> control what versions of code we're using where. Basically, to load a
>> package in R, one currently does:
>>
>> library(whateverPackage)
>>
>> and with the enhancement, you can ensure that you're getting at least
>> version X of the package:
>>
>> library(whateverPackage, version=3.14)
>>
>> Reasons one might want this include:
>>
>> * you know that in version X some bug was fixed
>> * you know that in version X some feature was added
>> * that's the first version you've actually tested it with& you don't
>> want to vouch for earlier versions without testing
>> * you develop on one machine& deploy on another machine you don't
>> control, and you want runtime checks that the sysadmin installed what
>> they were supposed to install
>
> I don't really see the need for this. Packages already have a scheme for
> requiring a particular version of a package, so this would only be
> useful in scripts run outside of packages. But what if your script
> requires a particular (perhaps obsolete) version of a package? This
> change only puts a lower bound on the version number, and version
> requirements can be more elaborate than that.
>
> I think my advice would be:
>
> 1. Put your code in a package, and use the version specifications there.
>
> 2. If you must write it in a script, then put a version test at the top,
> using packageVersion().
>
> Duncan Murdoch
>
>
>>
>> In general, I have an interest in helping R get better at various
>> things that would help it play in a "production environment", for
>> various values of that term. =)
>>
>> The attached patch is made against revision 58980 of
>> https://svn.r-project.org/R/trunk . I think this is the first patch
>> I've submitted to the R core, so please let me know if anything's
>> amiss, or of course if there are reservations about the approach.
>>
>> Thanks.
>>
>> --
>> Ken Williams, Senior Research Scientist
>> WindLogics
>> http://windlogics.com
>>
>>
>>
>> CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the
>> intended recipient(s) and may contain confidential and privileged
>> information. Any unauthorized review, use, disclosure or distribution
>> of any kind is strictly prohibited. If you are not the intended
>> recipient, please contact the sender via reply e-mail and destroy all
>> copies of the original message. Thank you.
>>
>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list