Skip to content

Possible bug in test_manifest_scaling #8

@FloSchuberth

Description

@FloSchuberth

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions