melff / memisc

Tools for Managing Survey Data, Creating Tables of Estimates and Data Summaries
https://melff.github.io/memisc
45 stars 8 forks source link

Items only recognized as numerical even when measurement is "nominal" #64

Open bixiou opened 6 months ago

bixiou commented 6 months ago

I noticed a bug with R 4.3.1 (my colleague does not have the bug with R 4.2.1). The following code returns NA instead of TRUE:

temp <- as.item(c(1), labels = structure(c(0, 1), names = c("No", "Yes")))
temp == "Yes"

This is despite measurement(temp) being nominal, i.e. we would expect that by default, temp is considered as string and not numerical.

Note that both temp == 1 and temp %in% "Yes" correctly return TRUE.

Is there a way to change this behavior?

My version of memisc is 0.99.22 (or rather, a patched version of 0.99.22, as explained here).

melff commented 6 months ago

The current version of memisc on CRAN is 0.99.31.7. Does this bug show up with that version as well?

bixiou commented 6 months ago

No, the bug is with the older version. But I need this older version, it has useful features which are not in the new one.

melff commented 6 months ago

Unfortunately, I can only support the newest version of the package. If there is any functionality missing in the newest version, please describe it, and I may consider (re-)implementing it or provide a workaround.

bixiou commented 6 months ago

As explained here, memisc 0.99.22 allows to run regressions without dropping data ('PNR' is considered as a response category, which it is) while allowing to treat these 'PNR' as missing in the analysis (i.e. have a special status for descriptive stats, graphs...).

It would be great, indeed, if this feature could be retained in the new versions.