How to avoid writing a row.names column when saving a data.frame using the xlsx package How to avoid writing a row.names column when saving a data.frame using the xlsx package r r

How to avoid writing a row.names column when saving a data.frame using the xlsx package


Set the rownames to NULL to remove them:

rownames(bd) <- NULL

Also, from xlsx documentation:

write.xlsx(x, file, sheetName="Sheet1",           col.names=TRUE, row.names=TRUE, append=FALSE)

Set row.names to FALSE to avoid the first column being row names.