Closed Br-Hesseling closed 9 months ago
Hello Brechtje,
it may be due to the data. The package expects a data frame in the data argument. We made some changes so that it works with tibbles (or other types), but there may still be issues. Could you please check if converting df1 to data.frame resolves the problem?
Viviane
Hello Viviane,
Thank you so much for your swift reply! I thought my df1 was already a dataframe, but when I checked its class it indeed showed
> class(df12) [1] "tbl_df" "tbl" "data.frame"
.
After converting it to data.frame it works! The R version in which this happened was R-4.3.1. I ran the same script with the same data on a virtual machine on which version R-4.1.2 is running and I did not encounter this issue. Wanted to let you know in case it's helpful. Thank you again, I am very happy to have it working now.
Best wishes, Brechtje
Dear Cécile and Vivianne,
Thank you very much for your lcmm package! I am currently conducting latent class growth analysis with up to 35 time points, for 230 individuals. I can succesfully create 1 up to 5 class models that converge. However, when I then want to use plot() to show the trajectories, I get the following error:
Error in xtfrm.data.frame(x) : cannot xtfrm data frames
My code is the following:
As it should, it produces an object of class
hlme
. Edited to add: I can use plot() for which = "residuals" and for which = "postprob", that works fine...When I create a similar model with the
lcmm::data_hlme
data, plotting the trajectories does work:When I compare
lcga2
tohlme2
, I do not see any differences between the two. I also made sure to use the same class variables in both models (numeric). I even tried if it made a difference if I removed cases with missing variables from my dataset, but that does not make a difference either.Do you have any suggestions as to what else I can check or change to make plot() work for "fit"?
Best wishes, Brechtje