svkucheryavski / mdatools

R package for Multivariate Data Analysis
https://mda.tools
Other
33 stars 11 forks source link

Error in `summary.simcares` when no reference class labels are used #109

Closed svkucheryavski closed 1 year ago

svkucheryavski commented 1 year ago

Method summary() for simcares objects raises an error if the object is created by using method predict() without reference class values:

data(people)
Xc <- people[people[, 9] == -1, ]
Xt <- people[people[, 9] ==  1, ]

m <- simca(Xc, "male", 10)
r <- predict(m, Xt)
summary(r)

Results in:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent

The actual bug is in method as.matrix.simcares() which attempts at add column names to empty result matrix.

In fact summary() must not be used in this case as there are no figures of merits but the bug must be fixed (e.g. the method must show a warning). Low priority bug which will be fixed in next release.

svkucheryavski commented 1 year ago

fixed in last release.