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

Trouble understanding check_key() #2221

Open
defuneste opened this issue Aug 2, 2024 · 1 comment
Open

Trouble understanding check_key() #2221

defuneste opened this issue Aug 2, 2024 · 1 comment
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@defuneste
Copy link

I had some trouble understanding check_key() when the columns provided is a valid unique key.

If the columns given in the ellipsis ARE a key, the data frame itself is returned silently, so that it can be used for piping.

Small example:

dat <- tibble(a = c(1, 2, 3), b = c(5, 5, 6), c = c(7, 8, 9))
(check_key(dat, a))
NULL

Should dat be returned instead of NULL or should the documentation be modified?

@krlmlr krlmlr added bug Something isn't working documentation Improvements or additions to documentation labels Nov 24, 2024
@krlmlr
Copy link
Collaborator

krlmlr commented Nov 24, 2024

Thanks, this is clearly a mismatch between behavior and documentation. I remember this working before, can we find out with what version this worked the last time?

options(conflicts.policy = list(warn = FALSE))
library(dm)

dat <- tibble(a = c(1, 2, 3), b = c(5, 5, 6), c = c(7, 8, 9))
out <- check_key(dat, a)
out
#> NULL

Created on 2024-11-24 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Development

No branches or pull requests

2 participants