Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMore informative error message for duplicate identifiers for rows. Addresses #426. #534
Conversation
hadley
reviewed
Jan 19, 2019
tests/testthat/test-spread.R
Outdated
@@ -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.
This comment has been minimized.
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?
juliasilge
added some commits
Jan 19, 2019
hadley
reviewed
Jan 19, 2019
tests/testthat/test-spread.R
Outdated
"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.
This comment has been minimized.
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
merged commit 0137bb4
into
tidyverse:master
Jan 19, 2019
This comment has been minimized.
This comment has been minimized.
Thanks @juliasilge! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
juliasilge commentedJan 19, 2019
The new format follows the format @hadley laid out in the discussion.