[R] Wildcards

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Mon Oct 15 21:17:58 CEST 2007



subura said the following on 10/15/2007 12:04 PM:
> Care to explain how i can use a wildcard expression to "source" all files
> ending with .R in a subdirectory ? I've tried something like this
> 'source(glob2rx("*.R"))' without success.
> 
> Thank you

Try

R.files <- list.files(my.path, pattern = glob2rx("*.R"), full = TRUE)
invisible(sapply(R.files, source))

HTH,

--sundar



More information about the R-help mailing list