collapse
collapse copied to clipboard
Pivot column with special characters
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
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.
This is now fixed.