philips-software / latrend

An R package for clustering longitudinal datasets in a standardized way, providing interfaces to various R packages for longitudinal clustering, and facilitating the rapid implementation and evaluation of new methods
https://philips-software.github.io/latrend/
GNU General Public License v2.0
28 stars 5 forks source link

predict.lcModel() result can trigger error in transformPredict() #120

Closed niekdt closed 2 years ago

niekdt commented 2 years ago

As revealed in https://github.com/philips-software/latrend/discussions/109#discussioncomment-3044356, the use of lcModelKML can trigger an error condition flow in transformPredict().

116 introduced a bug in transformPredict(). If the data contains a Cluster column but the predict method is not using the Cluster column information, transformPredict() is wrongly trying to use it for merging prediction data and new data.

Current fix: predict.lcModel will remove the Cluster column if it is not being used. Alternative potential solution: a similar useCluster toggle for transformPredict()