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

Pivot column with special characters #566

Open
alearrigo opened this issue Apr 23, 2024 · 1 comment
Open

Pivot column with special characters #566

alearrigo opened this issue Apr 23, 2024 · 1 comment

Comments

@alearrigo
Copy link

Hi,
I don't know if that's an issue or I'm doing something wrong but, given a long dataset

iris_long <- pivot(iris, "Species")

If I use pivot I have the correct result:

iris_long %>% 
  pivot(names = "variable",
        how = "wider")

but If I try to pivot on a variable with special characters like accented letters:

iris_long %>% 
  rename(vàriablè = variable) %>% 
  pivot(names = "vàriablè",
        how = "wider")

I get this error

Error in ckmatch(cols, nam) : Unknown columns: vàriablè

Thanks

@SebKrantz
Copy link
Owner

Hi, thanks for flagging this. Still need to look into it. Likely has something to do with string encoding. To be on the safe side always use accent free variable names, such as by applying janitor::clean_names() to your dataset before.

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

2 participants