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

no warning message about factor to character coercion shown when binding dataframes #2317

Closed
salim-b opened this issue Dec 13, 2016 · 4 comments
Closed
Labels

Comments

@salim-b
Copy link
Contributor

@salim-b salim-b commented Dec 13, 2016

With dplyr v0.4.0 warning messages were introduced when a coercion from type factor to character is needed to produce a valid result using bind_rows() and other operations.

If I run the following, the warning message is shown as expected:

> bind_rows(data_frame(a = factor("a")), data_frame(a = "a"))
# A tibble: 2 × 1
      a
  <chr>
1     a
2     a
Warnmeldung:
In bind_rows_(x, .id) :
  binding factor and character vector, coercing into character vector

Now if I switch the order of the dataframes, no warning message appears although the same coercion from type factor to character is applied to the second dataframe:

> bind_rows(data_frame(a = "a"), data_frame(a = factor("a")))
# A tibble: 2 × 1
      a
  <chr>
1     a
2     a

This behaviour seems confusing and in my eyes the warning message should appear in both cases.

I'm using dplyr 0.5.0 with R 3.3.2 on Ubuntu Linux 16.04 LTS.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Dec 13, 2016

Thanks, confirmed.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Feb 21, 2017

Warn in the second case, too

@hadley
Copy link
Member

@hadley hadley commented Feb 27, 2017

@zeehio I'd love your thoughts here too, if you have the time.

zeehio added a commit to zeehio/dplyr that referenced this issue Feb 27, 2017
My previous PR did not fix this case.
@zeehio
Copy link
Contributor

@zeehio zeehio commented Feb 27, 2017

@hadley Quick fix written in PR #2478

zeehio added a commit to zeehio/dplyr that referenced this issue Feb 27, 2017
My previous PR did not fix this case.
@hadley hadley closed this in #2478 Feb 27, 2017
hadley added a commit that referenced this issue Feb 27, 2017
My previous PR did not fix this case.
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants