Marcelo Luiz de Laia wrote:
> 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")
That's not even a valid regular expression in most applications,
but "dir" does allow it, for some reason. Anyway, I think you
are mixing globs and regular expressions. If "*.sens" is a glob,
then it will find all files ending with ".sens", which is not
the same as ".sens." which you said above.
Stefano Calza <[EMAIL PROTECTED]> wrote:
>
> dir(pattern="\\.sens+$")
That will find files ending with ".sens", ".senss", ".sensss",
etc.
To find files ending with ".sens.", the regex is
dir(pattern = "\\.sens\\.$")
If there is a file called just ".sens.", you have to use
"all.files = TRUE", since files beginning with a "." are
invisible.
Peter
--
Peter J. Acklam - [EMAIL PROTECTED] - http://home.online.no/~pjacklam
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html