Hey,
in the function test_manifest_scaling are to my opinion several issues:
line 17/18
mvs_class = sapply(MV, class)
mvs_as_factors <- mvs_class == "factor"
If you have an ordered factor the class of the variable is 'ordered' 'factor':
class(MV[,1])
[1] "ordered" "factor"
I suggest to replace the two lines by:
mvs_as_factors=sapply(MV, is.factor)
Furthermore in command line 35:
unordered = !apply(MV[,mvs_as_factors], 2, is.ordered)
if you use the apply function, as.matrix is applied on the input before it starts applying the function FUN on each column, Hence the observations of the indicators become of class character and a error message is returned..
A solution would be to use
sapply(MV[,mvs_as_factors],is.ordered)
Best regards
Hey,
in the function test_manifest_scaling are to my opinion several issues:
line 17/18
mvs_class = sapply(MV, class)
mvs_as_factors <- mvs_class == "factor"
If you have an ordered factor the class of the variable is 'ordered' 'factor':
I suggest to replace the two lines by:
mvs_as_factors=sapply(MV, is.factor)
Furthermore in command line 35:
unordered = !apply(MV[,mvs_as_factors], 2, is.ordered)
if you use the apply function, as.matrix is applied on the input before it starts applying the function FUN on each column, Hence the observations of the indicators become of class character and a error message is returned..
A solution would be to use
sapply(MV[,mvs_as_factors],is.ordered)
Best regards