For writing a single xtab, I have used:
For appending one more xtab to the same csv file, I tried:
write.csv(xtabData2, "analysis.csv", append=T)
But this throws a warning "attempt to set 'append' ignored" and overwrites the csv file.
One solution would be to join the tab data first using
write.csv(rbind(xtabData1, xtabData2), file="analysis.csv")
append option is disabled in
write.csv() is just a wrapper function for
write.table(). Here;s more from the help file.
write.csv and write.csv2 provide convenience wrappers for writing CSV files. They set sep and dec (see below), qmethod = "double", and col.names to NA if row.names = TRUE (the default) and to TRUE otherwise. write.csv uses "." for the decimal point and a comma for the separator. write.csv2 uses a comma for the decimal point and a semicolon for the separator, the Excel convention for CSV files in some Western European locales. These wrappers are deliberately inflexible: they are designed to ensure that the correct conventions are used to write a valid file. Attempts to change append, col.names, sep, dec or qmethod are ignored, with a warning.
write.table() instead (with
sep="," and whatever other settings you'd like).