[R] Doubt about pattern
Roger Bivand
Roger.Bivand at nhh.no
Thu Jan 29 16:02:29 CET 2004
On Thu, 29 Jan 2004, Marcelo Luiz de Laia wrote:
> Hi All,
>
> I have a very simple problem. I have several files in a same directory.
> I would like to send for an object only the files that finish in
> ".sens.". I execute the command below,
>
> files <- dir(pattern="*.sens")
see help(regexp) - "period '.' matches any single character" - I think you
need to escape the '.' possibly as "\\.sens$".
>
> but it includes all of the files that have "sens", independent of they
> be in the end or in the middle of the name of the file. How could I
> solve this? I sought in the html_help but I didn't find similar to this.
>
> My files
>
> "script_sens.txt", "Sen_155_01_R1.sens", "Sen_155_01_R2.sens",
> "Sen_155_01_R3.sens", "Sen_155_02_R1.sens", "Sen_155_02_R2.sens",
> "Sen_155_02_R3.sens", "Sen_155_03_R1.sens", "Sen_155_03_R2.sens",
> "Sen_155_03_R3.sens", "tome2sens_time1sens.txt"
>
> Tahnks very much
>
>
--
Roger Bivand
Econonic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway, voice: +47-55959355, fax: +47-55959393; Roger.Bivand at nhh.no
More information about the R-help
mailing list