From krcoombes at mdacc.tmc.edu  Mon Dec 15 20:20:51 2008
From: krcoombes at mdacc.tmc.edu (Kevin R. Coombes)
Date: Mon, 15 Dec 2008 13:20:51 -0600
Subject: [Rd] package development
In-Reply-To: <971536df0812150854m2db766a0j2e1398311bca623b@mail.gmail.com>
References: <200812112304.mBBN4stJ008607@rocky.mayo.edu>	
	<4941A995.1040409@stats.uwo.ca>	
	<49427147.5070204@bank-banque-canada.ca>	
	<e8e755250812120747x241cde78y65e12b3a27ea518a@mail.gmail.com>	
	<49428BB7.6030406@bank-banque-canada.ca>	
	<18757.28023.55046.821105@ron.nulle.part>	
	<49467842.6090004@mdacc.tmc.edu> <49467BE9.2020109@stats.uwo.ca>	
	<49467EBA.6070305@mdacc.tmc.edu> <49468935.9090906@stats.uwo.ca>
	<971536df0812150854m2db766a0j2e1398311bca623b@mail.gmail.com>
Message-ID: <4946AE13.6040802@mdacc.tmc.edu>

Hi,

I have now spent some time looking at whether this is possible with one 
repository. The _easy_ part is getting the selection list to display 
more information. Right now, the code that determines what is displayed 
is inside a function called "explode_bundles" that is defined internally 
to the "install.packages" function. In its entirety, here is that function:

     explode_bundles <- function(a) {
         contains <- .find_bundles(a, FALSE)
         extras <- unlist(lapply(names(contains), function(x)
             paste(contains[[x]], " (", x, ")", sep = "")))
         sort(as.vector(c(a[, 1], extras)))
     }

This is only called once, with the argument "a" begin the results of a 
call to "available.packages". If you simply change this function to 
something like

     explode_bundles <- function(a) {
         contains <- .find_bundles(a, FALSE)
         extras <- unlist(lapply(names(contains), function(x)
             paste(contains[[x]], " (", x, ")", sep = "")))
         sort(as.vector(c(paste(a[, 1], a[, 2], sep=", "), extras)))
     }

then packages will be listed in the selection list followed by their 
version numbers. (I don't know what this does to bundles, since my 
packages don't have any bundles for me to check the behavior.)

Making this change, however, will break the routine 
"utils:::.install.winbinary" (as well as the analogs on other platforms) 
which currently assumes that there is only one version of each package, 
and (even if there is more than one) always seems to install the newest 
one. But, in principle, the version number could be parsed back out of 
the pasted-together displayed names and used to tell these routines to 
install the actual version you want.

In the meantime, I'll bite the bullet and set up a second testing 
repository.

Thanks,
	Kevin

Gabor Grothendieck wrote:
> Perhaps it would be sufficient as a first step to just display the version
> that will be downloaded.  That would still only let you pick one but at
> least you would know which one.
> 
> On Mon, Dec 15, 2008 at 11:43 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>> On 12/15/2008 10:58 AM, Kevin R. Coombes wrote:
>>> I knew that (but forgot to include it in my statement of the question).
>>>  Thanks for pointing it out.
>>>
>>> Is there any way to convince the selection box (or its developers) to
>>> include the version information that is already available?
>> The selection box is adamant that it will only display one thing.
>>
>> The developers would like to have a grid display component, and then would
>> be happy to display more information about each package, but are unlikely to
>> write one, due to competing priorities.  If you wanted to contribute one...
>>
>> Duncan Murdoch
>>
>>>        Kevin
>>>
>>>
>>> Duncan Murdoch wrote:
>>>> On 12/15/2008 10:31 AM, Kevin R. Coombes wrote:
>>>>> Hi,
>>>>>
>>>>> Terry Therneau's question about package development reminded me of a
>>>>> different issue. I maintain several packages along with a repository for
>>>>> them at "http://bioinformatics.mdanderson.org/OOMPA/". Several people are
>>>>> working on adding features or testing the packages. So, I often want to have
>>>>> both the latest official release and the currently testable build of the
>>>>> package available in the repository. I tried putting both versions in the
>>>>> same repository, but this leads to a problem for some of the testers, who
>>>>> are not familiar with the intricacies of building packages. (Thus, I cannot
>>>>> just tell them to get the source tarball and compile it; they will have no
>>>>> clue as to what I am talking about. And their Windows machines will not have
>>>>> the required tools installed in any event.)
>>>>>
>>>>> The underlying problem is that when you run the command
>>>>>  >  install.packages(repos="http://bioinformatics.mdanderson.org/OOMPA")
>>>>> inside the R Windows GUI, the selection box that appears only lists the
>>>>> name of the package, _not_ the version number. Thus, the testers cannot tell
>>>>> which of two packages with the same name should be installed.
>>>>>
>>>>> Is there any way around this problem other than to maintain two
>>>>> different repositories?
>>>> available.packages() reports version numbers, e.g.
>>>>
>>>>
>>>>
>>>> available.packages(contrib.url("http://bioinformatics.mdanderson.org/OOMPA"))
>>>>
>>>> You'll need to write a user interface to make use of this.
>>>>
>>>> Duncan Murdoch
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>



[Rd] package development
Kevin R. Coombes