getting data to xlsx error (tidyLPA)

mfinal <- data %>%
select(intrinsic, career, determination, efficacy, grade) %>%
single_imputation() %>%
scale() %>%
estimate_profiles(3, variances = "varying", covariances = "varying" )
mfinal

get_data(mfinal)
write.csv(mfinal, "mfinal.csv")


using tidyLPA, i got the data and want to get excel file.
but there's error like this;
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) :
cannot coerce class ‘"Mclust"’ to a data.frame
how can I get the excel data?

Not familiar with that library, but it seems mfinal is a complex object that has many information that can't be saved as a table; with get_data() you're extracting the table-formatted information. So, the only problem is that you need to save the results of get_data(mfinal), and not directly mfinal. You can do that with an intermediary variable:

mfinal_as_table <- get_data(mfinal)
write.csv(mfinal_as_table, "mfinal.csv")