-
Notifications
You must be signed in to change notification settings - Fork 1
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
model.frame creates invalid interlaced vectors #13
Comments
This is because This C function drops na values from vectors, but then copies their attributes back on: https://github.com/wch/r-source/blob/b8b2662a848a8eb87d67d66d737b00b6b2b127f2/src/library/stats/src/model.c#L228 Here's where the copying happens: https://github.com/wch/r-source/blob/b8b2662a848a8eb87d67d66d737b00b6b2b127f2/src/main/attrib.c#L302 So this bypasses all of the proper indexing... how annoying! :( |
drop.unused.levels = TRUE
One way to fix this, could be to detect when the na channel has been corrupted: na_channel.interlacer_interlaced <- function(x, ...) {
m <- attr(x, "na_channel_values")
if (length(m) != length(x)) {
unspecified(length(x))
} else {
m
}
} |
Actually, what I should do is store a reference to the original data in another attribute. That way, I can detect if the current data changes its reference. If the current data changes its references (i.e. the data has been changed without updating its na_channel), then the na_channel should be invalidated. |
Created on 2024-09-30 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: