Skip to content

Commit

Permalink
add a better error message for zero-row data
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Feb 23, 2020
1 parent 8f97a37 commit f7ae06b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/data-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ validate_data <- function(data, bterms, na.action = na.omit2,
stop2("Variable names may not contain double underscores ",
"or underscores at the end.")
}
if (!isTRUE(nrow(data) > 0L)) {
stop2("All observations in the data were removed presumably because of ",
"NA values. If you are using the 'subset' addition term, please ",
"make sure that variables are not NA even if locally unused.")
}
groups <- get_group_vars(bterms)
data <- combine_groups(data, groups)
data <- fix_factor_contrasts(data, ignore = groups)
Expand Down

0 comments on commit f7ae06b

Please sign in to comment.