## Aaron Braver ## April 9, 2012 ## Combine tab-separated txt files from Praat ## to produce a single csv file ## Be sure to change the working directory ## and also the column names ##What directory are the files in? setwd("/Users/abraver/thefiles") all_data<-data.frame() filelist<-list.files(pattern="*.txt", recursive=FALSE) for (i in filelist) { this_file<-read.table(i, header=T, ,sep="\t", fill=T) cat("I'm working on file ", i, "\n") all_data<-rbind(all_data,this_file) } ## Set the names of each column in this vector. ## Presumably, the ones from my project won't work for you! colnames(all_data)<-c("speaker","tokennumber","token","type","repetition","","n","","c","","v","","gc","","gv","","") write.csv(all_data, file="0_combined.csv",row.names=FALSE)