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

writexl
#1

Hi,

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

0 Likes

Library xlsx and rJava
#2
library(writexl)
write_xlsx(list(stdresids = stdresids), path = "stdresids.xlsx")

source

1 Like

#3

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)
xlsx.openFile("stdresids.xlsx")

Please help me change xlsx into writexl.

0 Likes

#4

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

0 Likes

#5

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

#6

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

0 Likes

#7

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

closed #8

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.

0 Likes