Skip to content
Back to formatted view

Raw Message

Message-ID: <30211312.1075393196@lemmens.socsci.kun.nl>
Date: 2004-01-29T15:19:56Z
From: Paul Lemmens
Subject: Doubt about pattern
In-Reply-To: <20040129113325.00004242@lbmsala4>

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