Skip to content

Better checking of list arguments to bind_rows()#3068

Merged
krlmlr merged 6 commits intotidyverse:masterfrom
krlmlr:b-#3024-bind-unnamed
Sep 5, 2017
Merged

Better checking of list arguments to bind_rows()#3068
krlmlr merged 6 commits intotidyverse:masterfrom
krlmlr:b-#3024-bind-unnamed

Conversation

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Sep 3, 2017

@krlmlr krlmlr requested a review from hadley September 3, 2017 07:57
@lionel-
Copy link
Member

lionel- commented Sep 3, 2017

Argument 1 must have names

I think it should be: Argument 1 must be named

@lionel-
Copy link
Member

lionel- commented Sep 3, 2017

i.e. lists are treated as data frames so they should have outer names and the inner names of vectors are irrelevant.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 3, 2017

To me, in dplyr::bind_rows(a = df), the df is a named argument (because of the name a) but has names itself (the names of the columns. Can you please clarify which call should give which error message?

@lionel-
Copy link
Member

lionel- commented Sep 3, 2017

If there are unused outer names it should probably be a warning.

@lionel-
Copy link
Member

lionel- commented Sep 3, 2017

oh I understand now: "Argument 1 must have names". Argument 1 refers to the list, got it.

@lionel-
Copy link
Member

lionel- commented Sep 3, 2017

If there are unused outer names it should probably be a warning.

Though the outer names can be used as .id column right? So we should allow unused outer names.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 3, 2017

I'm not sure, this PR is just about fixing an annoyance just before the upcoming dplyr bugfix release, which may or may not be connected with a segfault only CRAN is seeing. Can we discuss wording of error messages after the release?

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function would be a bit easier to understand if the first check was to confirm that the input was a vector. But we can do that refactoring later, if needed.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 5, 2017

Simplified the check.

@krlmlr krlmlr requested a review from hadley September 5, 2017 13:31
@krlmlr krlmlr merged commit c65368f into tidyverse:master Sep 5, 2017
@krlmlr krlmlr deleted the b-#3024-bind-unnamed branch September 6, 2017 07:42
@lock
Copy link

lock bot commented Jan 18, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants