Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in test_manifest_scaling #8

Open
FloSchuberth opened this issue May 13, 2016 · 0 comments
Open

Possible bug in test_manifest_scaling #8

FloSchuberth opened this issue May 13, 2016 · 0 comments

Comments

@FloSchuberth
Copy link

FloSchuberth commented May 13, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant