write.xlsx with row.names=TRUE giving error "unused argument (row.names=TRUE)
1
2
Entering edit mode
3.5 years ago
Bine ▴ 60

Dear all,

This is driving me crazy, maybe someone has an idea.

I simply want to print the rows of my dataframe with

write_xlsx(dd, "Z:/dd.xlsx",row.names=TRUE)

But this error keeps coming:

"unused argument (row.names = TRUE)"

Why is it not working?

It works if I remove "rownames=TRUE", but then it doesnt print the rownames.

Thank you so much! Bine

R write.xlsx row.names • 6.5k views
ADD COMMENT
4
Entering edit mode
3.5 years ago

It appears write_xlsx doesn't have a parameter row.names. Why don't you just add a column for row names to the dataframe dd before writing it? Like:

dd$row_names <- rownames(dd) 
dd <- dd[, c(ncol(dd), 1:(ncol(dd)-1))] # Make row_names first column
ADD COMMENT
0
Entering edit mode

Thanks so much! It is working!! :) :) You saved my morning :)

ADD REPLY

Login before adding your answer.

Traffic: 1622 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6