oops, didn't read the question fully. If you want to create 2 master files:
cust1_files = list.files(path=path_to_my_files,pattern='cust1',full.names=TRUE) a=NULL for(this_file in cust1_files){ a=rbind(a,read.table(this_file)) } write.table(a,'cust1.master.txt') cust2_files = list.files(path=path_to_my_files,pattern='cust2',full.names=TRUE) a=NULL for(this_file in cust2_files){ a=rbind(a,read.table(this_file)) } write.table(a,'cust2.master.txt') On Mon, Mar 30, 2009 at 8:55 AM, Mike Lawrence <mike.lawre...@dal.ca> wrote: > my_files = list.files(path=path_to_my_files,pattern='.txt',full.names=TRUE) > > a=NULL > for(this_file in my_files){ > a=rbind(a,read.table(this_file)) > } > write.table(a,my_new_file_name) > > > > > On Sun, Mar 29, 2009 at 10:37 PM, Qianfeng Li <qflic...@yahoo.com> wrote: >> >> >> how to input multiple .txt files? >> >> A data folder has lots of .txt files from different customers. >> >> Want to read all these .txt files to different master files: >> >> such as: >> >> cust1.xx.txt, cust1.xxx.txt, cust1.xxxx.txt,.............. to master file: >> X.txt >> >> cust2.xx.txt, cust2.xxx.txt, cust2.xxxx.txt,.............. to master file: >> Y.txt >> >> >> Thanks! >> >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Mike Lawrence > Graduate Student > Department of Psychology > Dalhousie University > > Looking to arrange a meeting? Check my public calendar: > http://tinyurl.com/mikes-public-calendar > > ~ Certainty is folly... I think. ~ > -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University Looking to arrange a meeting? Check my public calendar: http://tinyurl.com/mikes-public-calendar ~ Certainty is folly... I think. ~ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.