[R] R2.1.0: Bug in list.files
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu May 12 11:01:45 CEST 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".
No! Replacing "*.txt" with ".txt" does something (you do not intend)!
Please read about regular expressions (!!!) and try to understand that
".txt" also finds "Not_a_txt_file.xls" ....
Uwe Ligges
> -s.
>
>
> Uwe Ligges wrote:
>
>> Steve Roberts wrote:
>>
>>> R2.0.1 (MS Windows)
>>>
>>>
>>>> list.files(myloc,"*.zip",full=T)
>>>
>>>
>>>
>>> [1] "P:/SARsoftware/Rlibraries/gnlm_0.1.zip"
>>> [2] "P:/SARsoftware/Rlibraries/lms2_0.2.zip"
>>>
>>>
>>> R2.1.0:
>>>
>>>
>>>> list.files(myloc,"*.zip",full=T)
>>>
>>>
>>>
>>> Error in list.files(path, pattern, all.files, full.names, recursive)
>>> : invalid 'pattern' regular expression
>>
>>
>> >
>>
>>> Bug? or have I missed something
>>
>>
>>
>> You missed to read the NEWS that tells you:
>>
>> o The regular expression code is now based on that in glibc 2.3.3.
>> It has stricter conformance to POSIX, so metachars such as
>> { } + * may need to be escaped where before they did not
>> (but could have been).
>>
>>
>> Probably you want
>>
>> list.files(pattern = "\\.zip$", full.names = TRUE)
>>
>> Uwe Ligges
>>
>>
>>> Steve.
>>> Dr Steve Roberts steve.roberts at manchester.ac.uk
>>>
>>> Senior Lecturer in Medical Statistics,
>>> CMMCH NHS Trust and University of Manchester Biostatistics Group,
>>> 0161 275 5192/5764 / 0161 276 5785
>>>
>>> ______________________________________________
>>> R-help at 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
>>
>>
>>
>> ______________________________________________
>> R-help at 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
>>
>
> ______________________________________________
> R-help at 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
More information about the R-help
mailing list