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

fct_recode(), rename factor level to f doesn't work #84

Closed
Tazinho opened this issue Feb 26, 2017 · 4 comments
Closed

fct_recode(), rename factor level to f doesn't work #84

Tazinho opened this issue Feb 26, 2017 · 4 comments

Comments

@Tazinho
Copy link

Tazinho commented Feb 26, 2017

The following gives an error, since f is also the name of the data argument.
Is there a recommended workaround for these situations?

a <- factor(letters[1:5])
forcats::fct_recode(a, f= "a", h = "b")
Error: Each input to fct_recode must be a single named string. Problems at positions: 1

@QuentinRoy
Copy link

QuentinRoy commented Aug 13, 2017

Same issue. I believe the problem is that 'f' is recognized as false in check_recode_levels of recode.R:

  is_ok <- function(x) is.character(x) && length(x) == 1
  ok <- vapply(levels, is_ok, logical(1))

@hadley
Copy link
Member

hadley commented Feb 10, 2018

Thanks for the bug report! I'll attack this systematically as part of #110

@hadley hadley closed this as completed Feb 10, 2018
@gabrielburcea
Copy link

i got this problem for fct_recode. I have useed !!! and haven't succeded ..

Each input to fct_recode must be a single named string. Problems at positions: 1, 2

@batpigandme
Copy link
Contributor

Commenting on a closed issue is pretty low visibility. Before opening a new thread here, let's see if we can get things sorted on https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer.)

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

No branches or pull requests

5 participants