changed write.csv to write.table