Re: [R] R2.1.0: Bug in list.files

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Fri 13 May 2005 - 00:17:32 EST

On Thu, 12 May 2005, Suresh Krishna wrote:
> Is that the entire story ? I tried this with yesterday's patched version
> (windows xp) and found:
>
>> list.files(getwd(),"*.txt",full=T)
> Error in list.files(path, pattern, all.files, full.names, recursive) :
> invalid 'pattern' regular expression
>
>> list.files(getwd(),'.txt',full=T)
> [1] "C:/Documents and Settings/suresh/BDE_SysInfo.txt"
> [2] "C:/Documents and Settings/suresh/dxva_sig.txt"
>
> Replacing "*.txt" with '*.txt' seems to do "something".
>

It finds any file name containing the substring txt beginning anywhere except the first letter. Now, this is exactly what *.txt used to do, so in that sense it is equivalent, but it probably isn't what you wanted. The pattern argument to list.files isn't a Windows wildcard expression. It never has been a Windows wildcard expression. It just so happens that ".txt" is also a valid regular expression, but one that means something different from the Windows wildcard expression "*.txt".

         -thomas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 13 00:29:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:44 EST