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

Explicitly disallow data frames with NA or "" names #6760

Merged

Conversation

DavisVaughan
Copy link
Member

Closes #6758

@DavisVaughan DavisVaughan force-pushed the feature/block-missing-and-empty-names branch from 00b2981 to d176ed5 Compare February 24, 2023 19:21
@DavisVaughan DavisVaughan merged commit 0fdf5b4 into tidyverse:main Feb 24, 2023
@DavisVaughan DavisVaughan deleted the feature/block-missing-and-empty-names branch February 24, 2023 19:32
@otoomet
Copy link

otoomet commented Mar 2, 2023

I run into a confusing error:

> df <- data.frame(a = 1:2, b = 2:1)
> names(df)[1] <- ""
> mutate(df, x = 3)
Error in initialize(...) : attempt to use zero-length variable name
> packageVersion("dplyr")
[1] ‘1.1.0’

I understand that it is fixed now in a sense that mutate (& friends) will provide a more informative error message? I thought that something is wrong with my provided variable names ("x" in the example above).

Thanks for your work!

@DavisVaughan
Copy link
Member Author

Looks like this in the dev version

df <- data.frame(a = 1:2, b = 2:1)
names(df)[1] <- ""
dplyr::mutate(df, x = 3)
#> Error in `dplyr::mutate()`:
#> ! Can't transform a data frame with `NA` or `""` names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

filter(dd, ...) throws bad error when names(dd) contains NA
2 participants