write.xlsx row.names = FALSE

I am using write.xlsx to add data to new sheets in excel.
When I run this, everything works fine:
write.xlsx(data, file = "file.xlsx", sheetName = "DDS vs MDS", append = TRUE)

When I try to do the same thing but exclude the pointless first column, it doesn't work:
write.xlsx(data, file = "file.xlsx", sheetName = "DDS vs MDS", row.names = FALSE, append = TRUE)

It gives me error:
the condition has length > 1 and only the first element will be used

What am I missing?

I figured it out.

First the data needs to be set as a data frame. So,

data2 <- as.data.frame(data)

Then you can continue with the code with no errors

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.