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

More informative error message for duplicate identifiers for rows. Addresses #426. #534

Merged
merged 4 commits into from Jan 19, 2019

Conversation

Projects
None yet
2 participants
@juliasilge
Copy link
Contributor

juliasilge commented Jan 19, 2019

The new format follows the format @hadley laid out in the discussion.

@@ -24,7 +24,10 @@ test_that("convert turns strings into integers", {
test_that("duplicate values for one key is an error", {
df <- tibble(x = factor(c("a", "b", "b")), y = c(1, 2, 2), z = c(1, 2, 2))
expect_error(spread(df, x, y),
"Duplicate identifiers for rows (2, 3)",
paste0("Each row of output must be identified by a unique combination of keys.\n",

This comment has been minimized.

@hadley

hadley Jan 19, 2019

Member

This is a bit long — the match text is a regular expression, so can you please tweak it to just match a reasonable fragment of the full error?

"Do you need to create unique ID with tibble::rowid_to_column()?"),
fixed = TRUE
)
"Each row of output must be identified by a unique combination of keys.")

This comment has been minimized.

@hadley

hadley Jan 19, 2019

Member

Can you please also use the tidyverse style indent? https://style.tidyverse.org/syntax.html#long-lines (sorry to miss this before)

@hadley hadley merged commit 0137bb4 into tidyverse:master Jan 19, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@hadley

This comment has been minimized.

Copy link
Member

hadley commented Jan 19, 2019

Thanks @juliasilge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment