From: Michaell Taylor (Mike@michaelltaylor.com)
Date: Thu 26 Dec 2002 - 23:57:12 EST
Message-id: <200212260757.12734.Mike@michaelltaylor.com>
There are lots of ways you could approach this:
files _ list.files('.')
files _ files[grep('.PRN$',files)]
for (File in files){
scan(file=File)
....
}
would provide lots of flexibility - grep could be used to specify 'irregular'
types of file names.
If you have very structured file names, then your example would be great.
for i in 1:20
{
filename = paste("***",i,+".PRN",sep='')
scan(file=filename)
....
}
Michaell Taylor
On Wednesday 25 December 2002 10:02 am, Zhongming Yang spoke unto the masses
thusly:
> Hi,
>
> I want to use R handle hundreds data file. So I want use some string
> class to handle the names of data file.
>
> My idea procedure like:
>
> for i in 1:20
> {
> filename = "***" + i +".PRN"
> scan(filename)
> ....
> }
>
> Do anyone know how to do this?
>
> Thanks,
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
-- ========================================= Michaell______________________________________________ R-help@stat.math.ethz.ch mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
This archive was generated by hypermail 2.1.3 : Tue 01 Jun 2004 - 09:31:59 EST