You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered a possible bug in assertr. I can't be certain, because I'm unable to provide a reproducible example: the data is covered by NDA. My code looks like this:
filter_bad <- function(list_of_errors, data = NULL, ...){
# We are checking to see if there are any errors that
# are still attached to the data.frame
if(!is.null(data) && !is.null(attr(data, "assertr_errors"))) {
errors <- append(attr(data, "assertr_errors"), errors)
}
# All `assertr_error` S3 objects have `print` and `summary` methods
# here; we will call `print` on all of the errors since `print`
# will give us the complete/unabridged error report
suppressWarnings(
list_of_errors %>%
furrr::future_map(
function(x) {
message(x$message) # For output logging
print(x$message) # For output logging
return(x$error_df) # Get the detailed error information
}
) %>%
dplyr::bind_rows() %>% # Bind together all the detailed error information
{.} -> error_df
)
error_df %>%
dplyr::pull(index) %>% # Get the indices of the affected rows
{.} -> indices
data %>%
tibble::rownames_to_column() %>% # Add a temporary row index
tidylog::filter(!(rowname %in% indices)) %>% # Filter out the bad rows and log actions
dplyr::select(-rowname) %>% # Remove temporary row index
{.} -> data
attr(data, "data_errors") <- error_df # Set an attribute of the data containing errors found
return(data)
}
It seems that assertr is trying to construct a data.frame containing error information, with vectors of differing lengths. There could be something quirky happening in my data, but it's difficult for me to tell because the data contains over four million rows, and I don't know what could be triggering this behaviour. In any case, there's some case that causes a crash that isn't caught in assertr, where the crash happens. Can you investigate, please?
The text was updated successfully, but these errors were encountered:
The problem is that if the predicate is very long, such as in the example above, the predicate is split up and name.of.predicate holds the predicate as a vector of strings rather than as a single value. The creation of the data.frame then fails. I have been able to avoid this by shortening the length of my predicates. In the example above, I store all the valid values in a vector valid.values and do in_set(valid.values) instead -- and the problem goes away.
Heads up, pretty soon there are going to a big merge into this repo (from a fork)
If this error persists after the merge, I'll definitely have to fix this
Hi,
I've encountered a possible bug in assertr. I can't be certain, because I'm unable to provide a reproducible example: the data is covered by NDA. My code looks like this:
filter_bad
is the function mentioned in #86:Here's the traceback following the error:
It seems that assertr is trying to construct a data.frame containing error information, with vectors of differing lengths. There could be something quirky happening in my data, but it's difficult for me to tell because the data contains over four million rows, and I don't know what could be triggering this behaviour. In any case, there's some case that causes a crash that isn't caught in assertr, where the crash happens. Can you investigate, please?
The text was updated successfully, but these errors were encountered: