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

tibble() gives inconsistent error messages for duplicate column names #291

Closed
huftis opened this issue Aug 4, 2017 · 2 comments
Closed

tibble() gives inconsistent error messages for duplicate column names #291

huftis opened this issue Aug 4, 2017 · 2 comments

Comments

@huftis
Copy link

@huftis huftis commented Aug 4, 2017

tibble() gives inconsistent error message for duplicate column names. See the following reprex:

library(tibble)
tibble(x1 = 1, x1 = 1)
#> Error: Column `x1` must have a unique name
tibble(x2 = 2, x1 = 1, x1 = 1)
#> Error: Column `x1` must have a unique name
tibble(x1 = 1, x1 = 1, x2 = 2)
#> Error: Data source must be a dictionary

Note that the last error message is different from the previous error messages, even though the cause of the error is identical.

I tested this with the latest GitGub version of the tibble package.

@huftis huftis changed the title tibble() gives inconsistent error message for duplicate column names tibble() gives inconsistent error messages for duplicate column names Aug 4, 2017
@krlmlr krlmlr closed this in cd6337e Aug 5, 2017
@krlmlr
Copy link
Member

@krlmlr krlmlr commented Aug 5, 2017

Thanks for bringing this up, it helped discovering an apparent regression with the lst() function.

krlmlr added a commit that referenced this issue Aug 22, 2017
Bug fixes
---------

- Values of length 1 in a `tibble()` call are recycled prior to evaluating subsequent arguments, improving consistency with `mutate()` (#213).
- Recycling of values of length 1 in a `tibble()` call maintains their class (#284).
- `add_row()` now always preserves the column data types of the input data frame the same way as `rbind()` does (#296).
- `lst()` now again handles duplicate names, the value defined last is used in case of a clash.
- Adding columns to zero-row data frames now also works when mixing lengths 1 and 0 in the new columns (#167).
- The `validate` argument is now also supported in `as_tibble.tbl_df()`, with default to `FALSE` (#278).  It must be passed as named argument, as in `as_tibble(validate = TRUE)`.

Formatting
----------

- `format_v()` now always surrounds lists with `[]` brackets, even if their length is one. This affects `glimpse()` output for list columns (#106).
- Factor levels are escaped when printing (#277).
- Non-syntactic names are now also escaped in `glimpse()` (#280).
- `tibble()` gives a consistent error message in the case of duplicate column names (#291).
@github-actions
Copy link

@github-actions github-actions bot commented Dec 13, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants