Re: [R] how to input multiple .txt files

2009-03-30 Thread hadley wickham
On Mon, Mar 30, 2009 at 10:33 AM, Mike Lawrence wrote: > To repent for my sins, I'll also suggest that Hadley Wickham's "plyr" > package (http://had.co.nz/plyr/) is also useful/parsimonious in this > context: > > a <- ldply(cust1_files,read.table) You might also want to do names(cust1_files) <-

Re: [R] how to input multiple .txt files

2009-03-30 Thread Mike Lawrence
To repent for my sins, I'll also suggest that Hadley Wickham's "plyr" package (http://had.co.nz/plyr/) is also useful/parsimonious in this context: a <- ldply(cust1_files,read.table) On Mon, Mar 30, 2009 at 9:32 AM, baptiste auguie wrote: > may i suggest the following, > > > a <- do.call(rbind,

Re: [R] how to input multiple .txt files

2009-03-30 Thread baptiste auguie
may i suggest the following, a <- do.call(rbind, lapply(cust1_files, read.table)) (i believe expanding objects in a for loop belong to the R Inferno) baptiste On 30 Mar 2009, at 12:58, Mike Lawrence wrote: cust1_files = list.files(path=path_to_my_files,pattern='cust1',full.names=TRUE) a

Re: [R] how to input multiple .txt files

2009-03-30 Thread Mike Lawrence
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(pa

Re: [R] how to input multiple .txt files

2009-03-30 Thread Mike Lawrence
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 wrote: > > > how to input multiple .txt files? > > A data fol

[R] how to input multiple .txt files

2009-03-29 Thread Qianfeng Li
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..txt,.. to master file: X.txt cust2.xx.txt, cust2.xxx.txt, cust2.