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

Quick fix for bug introduced by #433 #434

Merged
merged 2 commits into from
Jul 7, 2023
Merged

Conversation

fweber144
Copy link
Collaborator

This is a quick fix for a bug introduced by PR #433. Illustration of the bug (the RDS file is available here):

arr1 <- readRDS("arr1.rds")
devtools::load_all()
str(arr2augmat(arr1, margin_draws = 1))

At the current state of master (commit 5717fd4), the last line fails with the error

Error in `[.augvec`(ob, !is.na(ob)) : is_wholenumber(n_discr) is not TRUE

With this PR, the last line does not fail anymore.

It is only a quick fix because as a longer-term objective, it would probably be better to replace the role of attribute nobs_orig by an attribute that refers to the number of (possibly latent) response categories. The reason is that subsetting the rows of an augmented-rows matrix (or the elements of an augmented-length vector) is only legal in terms of the observations (individuals), not in terms of the (possibly latent) response categories. So the number of (possibly latent) response categories should always stay the same, in contrast to the number of observations. str() (and possibly other functions) may not adhere to the subsetting convention we are requiring, but even in those cases, it should be ok to assume the number of (possibly latent) response categories not to change (for str(), this is indeed correct). I'm sorry that the nobs_orig thing seems to have been a bad design choice from my side in PR #322.

…ly a

quick fix because as a longer-term objective, it would probably be better to
replace the role of attribute `nobs_orig` by an attribute that refers to the
number of (possibly latent) response categories.
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

Successfully merging this pull request may close these issues.

None yet

1 participant