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

Use only ASCII characters in R code #6

Open
nfrerebeau opened this issue Feb 7, 2023 · 4 comments
Open

Use only ASCII characters in R code #6

nfrerebeau opened this issue Feb 7, 2023 · 4 comments
Assignees

Comments

@nfrerebeau
Copy link
Member

Portable packages must use only ASCII characters in their R code.

@nfrerebeau nfrerebeau self-assigned this Feb 7, 2023
@RLumSK
Copy link
Collaborator

RLumSK commented Feb 7, 2023

@nfrerebeau Not really, but you have to define UTF-8 in the DESCRIPTION file.

@nfrerebeau
Copy link
Member Author

Encoding is already defined in DESCRIPTION:

Encoding: UTF-8

Am I missing somthing?

@RLumSK
Copy link
Collaborator

RLumSK commented Feb 9, 2023

Got it; I saw the error now. It comes from the column names with µm etc. OK, I have no immediate solution.

@RLumSK
Copy link
Collaborator

RLumSK commented Feb 9, 2023

@nfrerebeau I browsed a little bit through the problem. The Unicode characters are used mainly for the units in the tables. R supports a portable way for Unicode characters, but only in character strings. It does not work for column names because all characters are prompted as is. I see one solution by using tibbles instead of base R data frames. They can handle the encoding properly. For instance, df is a tibble it would read:

colnames(df) <- "\u00B5"
df[1,]
# A tibble: 10 × 1
       µ
   <int>
 1     1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Low priority
Development

No branches or pull requests

2 participants