[R] Doubt about pattern
Paul Lemmens
P.Lemmens at nici.kun.nl
Thu Jan 29 16:19:56 CET 2004
Hoi Marcelo,
--On donderdag 29 januari 2004 11:33 -0300 Marcelo Luiz de Laia
<mlaia at fcav.unesp.br> wrote:
>
> files <- dir(pattern="*.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.
>
That's because your pattern is a regular expression and not a Windows/DOS
wildcard. You'll need something like
files <- dir(pattern="\.sens$")
\. matches the dot itself (without the slash it's a wildcard for any
character) and the dollar sign $ matches the end of the filename. So this
way you'll get every file that has 'sens' as its extension
regards,
Paul
--
Paul Lemmens
NICI, University of Nijmegen ASCII Ribbon Campaign /"\
Montessorilaan 3 (B.01.03) Against HTML Mail \ /
NL-6525 HR Nijmegen X
The Netherlands / \
Phonenumber +31-24-3612648
Fax +31-24-3616066
More information about the R-help
mailing list