updated from write.csv to write.table to produce a txt file