You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using lavpredict however I am getting this error:
"Error: lavaan->lav_predict_fy_eta.i():
unknown type: `character' for variable: as1"
I see there is an earlier thread on this. And lionel posted this response. I follow the advice but still get the error. Would really appreciate advice on what to do.
The labelled class is considered to be a temporary class, and the onus is on the user to convert labelled classes to factors before getting into data analysis. In any case, lavaan should not do anything. I am not sure how converting to data frame fixes the issue with inputs containing haven-labelled columns.
# a tibble df: convert to data.frame and hope for the best
data<- as.data.frame(data)
}
I recommend doing this for any classes that inherit from data frame. For instance data.table does data-masking among other special interpretation of subsetting. This could introduce scoping issues in your code. Another example, sf data frames maintain a sticky geometry column, which means that the usual invariant length(sf[1:n]) == n is not applicable.
If you convert inputs to a data frame, there is no need to hope for the best because you control exactly the interface you're using.
I am using lavpredict however I am getting this error:
"Error: lavaan->lav_predict_fy_eta.i():
unknown type: `character' for variable: as1"
I see there is an earlier thread on this. And lionel posted this response. I follow the advice but still get the error. Would really appreciate advice on what to do.
The labelled class is considered to be a temporary class, and the onus is on the user to convert labelled classes to factors before getting into data analysis. In any case, lavaan should not do anything. I am not sure how converting to data frame fixes the issue with inputs containing haven-labelled columns.
Regarding:
lavaan/R/xxx_lavaan.R
Lines 64 to 67 in 290cc70
I recommend doing this for any classes that inherit from data frame. For instance data.table does data-masking among other special interpretation of subsetting. This could introduce scoping issues in your code. Another example, sf data frames maintain a sticky geometry column, which means that the usual invariant
length(sf[1:n]) == n
is not applicable.If you convert inputs to a data frame, there is no need to hope for the best because you control exactly the interface you're using.
Originally posted by @lionel- in #163 (comment)
The text was updated successfully, but these errors were encountered: