Maybe doing it in two steps since I'm not aware of a way to refer to
variable's name directly in list.files()

pdate <- c(22, 17)
expr <- paste0("pine_Height_(", paste0(pdate, collapse = "|"), ")")

pine<- list.files(path= "/run019", pattern = expr, full.names=TRUE)

Etienne


2013/1/7 K Jjw <kjjw32@yahoo.com>

> Hi
>
> I am trying to load a bunch of files. My files are indexed by numbers. I
> have a numeric expression pdate which lists all the numbers of the files
> that I want. I want to be able to change pdate as and when needed to load
> in different files. How do I get this to work? Right now I am using
>
> pine<- list.files(path= "/run019",pattern="pine_Height_(?:pdate)",
> full.names=TRUE)
>
> But it isnt working and I cannot seem to figure out the correct regular
> expression so that it will look at all the numbers in pdate. I have no
> background in regular expressions so I have been looking at
> http://perldoc.perl.org/perlre.html#Regular-Expressions with no success
> so far.
>
> Any help would be greatly appreciated.
>
> Thanks
>
> Kjj
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

