I was able to reproduce this issue in my RStudio Cloud instance. I don't know the underlying cause, but it appears to be something to do with clean_names
itself, as it happens with every data frame I've tried, including ones with legal names. Here's an example using the built-in billboard
data frame:
library(tidyverse)
library(janitor)
# Change to an illegal column name in the first position
names(billboard)[1] = "Province/State"
Now let's use set_names
to change /
to _
, making the name legal. Even then we still get the error from clean_names
:
billboard %>%
pivot_longer(cols = -`Province/State`:-date.entered) %>%
set_names(gsub("/","_", names(.))) %>%
clean_names()
Error in stringi::stri_trans_general(replaced_names, id = "Greek-Latin;Latin-ASCII;Accents-Any;Any-ASCII") :
A '::id' rule specifies an unknown transliterator. (U_INVALID_ID)
Actually, the same error occurs even if the names all start out legal:
clean_names(mtcars)
Error in stringi::stri_trans_general(replaced_names, id = "Greek-Latin;Latin-ASCII;Accents-Any;Any-ASCII") :
A '::id' rule specifies an unknown transliterator. (U_INVALID_ID)
Here's a workaround:
billboard %>%
pivot_longer(cols = -`Province/State`:-date.entered) %>%
set_names(tolower(make.names(names(.))))
Hopefully someone else will be able to explain why clean_names
is erroring in RStudio Cloud.