addes write.table for final dataset