I have created a new dataset in R and want to export it to excel to error check it. I am trying to use the xlsx package and when I run my export code I get this error: Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ‘structure("crPar", package = "randomizeR")’ to a data.frame. I tried google searching this error code and nothing came up. Does anyone know what this error menas and how I can solve it? Below is my code. It's the last line that throws the error message.
K<- 2
GTP4<- randomizeR::crPar(581, K = 2, ratio = rep(1, K), groups =
LETTERS[1:K])
library(xlsx)
xlsx::write.xlsx(GTP4, "D:/T Drive/GTP Factor analysis/GTP4.xlsx")
crParisn't a data frame, or even a data set, really, that I can tell. It's a special S4 object. If you want to save that object to a file, you'd have to use something likesaveRDS. - joran