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

Give more informative error message when passing weights with Inf value! #346

Open
joethorley opened this issue Jan 24, 2024 · 0 comments
Open

Comments

@joethorley
Copy link
Collaborator

  data <- ssddata::ccme_boron
  
  data$Weight <- 1
  data$Weight[rank(data$Conc) > 6] <- 0
  
  expect_error(ssd_fit_dists(data, dists="lnorm", weight = "Weight"),
               "^`data` has 22 rows with zero weight in 'Weight'\\.$")

  data$Weight[rank(data$Conc) > 6] <- -1
  
  expect_error(ssd_fit_dists(data, dists="lnorm", weight = "Weight"),
               "^`data\\$Weight` must have values between 0 and Inf\\.$")
  
  data$Weight[rank(data$Conc) > 6] <- Inf
  
  expect_warning(expect_error(ssd_fit_dists(data, dists="lnorm", weight = "Weight"),
               "^All distributions failed to fit\\.$"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant