translating xlsx.writeMultipleData("stdresids.xlsx", stdresids)" from library (xlsx) to library(writexl)


Please show me how can i change command "xlsx.writeMultipleData("stdresids.xlsx", stdresids)" from library (xlsx) to library(writexl)

write_xlsx(list(stdresids = stdresids), path = "stdresids.xlsx")


1 Like

Dear Prof. Long,

First, your kind assistance would be appreciated.

I cannot run the code under your recommendation.
stdresids <- matrix(nrow=600,ncol=7)
for(i in 1:600)
stdresids[i,1] <- stdres1[i]
stdresids[i,2] <- stdres2[i]
stdresids[i,3] <- stdres3[i]
stdresids[i,4] <- stdres4[i]
stdresids[i,5] <- stdres5[i]
stdresids[i,6] <- stdres6[i]
stdresids[i,7] <- stdres7[i]
xlsx.writeMultipleData("stdresids.xlsx", stdresids)

Please help me change xlsx into writexl.

the errors are: Error in write_xlsx(list(stdresids = stdresids), path = "stdresids.xlsx") :
Argument x must be a data frame or list of data frames

Your data has to be a dataframe not a matrix, also, we dont know from where stdres1, stdres2, ... come frome

Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

1 Like

I would like to thank you so much for your kind help. I can run the program

Could you share how you solved your problem and mark that as the solution? That could be helpful to others facing the same problem.

1 Like

This topic was automatically closed 21 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.