From murdoch at stats.uwo.ca  Thu Jun 23 22:46:46 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 23 Jun 2005 16:46:46 -0400
Subject: [Rd] list.files() reorders files  in R CMD INSALL
In-Reply-To: <42BB1DB7.8050004@stats.uwo.ca>
References: <C698D707214E6F4AB39AB7096C3DE5A5AB50FD@phost015.EVAFUNDS.intermedia.net>
	<42BB1DB7.8050004@stats.uwo.ca>
Message-ID: <42BB1FB6.9090808@stats.uwo.ca>

On 6/23/2005 4:38 PM, Duncan Murdoch wrote:
> On 6/23/2005 4:18 PM, Vadim Ogranovich wrote:
>> Hi,
>>  
>> The list.files() function seems to order its result vector differently
>> when is run during R CMD INSTALL. Here is an example:
>>  
>> ~% mkdir ~/FOO
>> ~% cd ~/FOO/
>> ~/FOO% touch a A b B
>> ~/FOO% ls
>> a  A  b  B
>> 
>>  
>> Put foo.R in the vor package. The foo.R just prints the files in ~/FOO:
>> print(list.files("~/FOO"))
>> 
>> Now install the package:
>> ~/FOO% R CMD INSTALL -l ~/R/library/ ~/src/vor/
>> * Installing *source* package 'vor' ...
>> ** libs
>> make: `vor.so' is up to date.
>> ** R
>> ** preparing package for lazy loading
>> [1] "A" "B" "a" "b"
>>  
>> ** help
>>  >>> Building/Updating help pages for package 'vor'
>>      Formats: text html latex example 
>> * DONE (vor)
>> 
>>  
>> Note that the files are listed as: [1] "A" "B" "a" "b"
>>  
>> Now start an R session
>>> list.files("~/FOO")
>> [1] "a" "A" "b" "B"
>> 
>> which differs in order from that in R CMD INSTALL.
> 
> Looks like the sorting is being done in the C locale in the first case, 
> and in a different one in the second.  See ?locales for how to set the 
> locale to what you want.

... when in R, and see the R Extensions manual for setting it during the 
INSTALL.

Duncan Murdoch



[Rd] list.files() reorders files in R CMD INSALL
Duncan Murdoch