I noticed that I can use some Greek letters as names while others will be either illegal or just aliases to letters from the latin alphabet.
Basically I can use
β is changed to
ß when printing and
β act as alliases)
list(β = 1) # $ß #  1 list(μ = 1) # $µ #  1
α, Γ, δ, ε, Θ, π, Σ, σ, τ, Φ, φ and Ω are allowed but act as alliases to latin letters.
list(α = 1) # $a #  1 αa <- 42 aa #  42 GG <- 33 ΓΓ #  33
Other letters I’ve tested just don’t “work”:
ι <- 1 # Error: unexpected input in "" Λ <- 1 # Error: unexpected input in "" λ <- 1 #Error: unexpected input in ""
I was surprised about
λ as it’s defined by the package
define_lambda, so I assume this depends on the system.
I know similar or identical looking characters can have different encodings, and some of them don’t go well with copy/paste between apps, the code of this question returns the described output when pasted back to RStudio.
?make.names says :
A syntactically valid name consists of letters, numbers and the dot or
underline characters and starts with a letter or the dot not followed
by a number
So part of the question is : what’s a letter ? and what’s going on here ?
- Are there greek characters that will safely work on all R installations, in particular, are
ß) safe to use in a package.
- why isn’t
intToUtf8(955)) usable on my system while it seems to be commonly use by
- Are there other non latin letters, greek or not, that I could safely use in my code ? (for instance Norwegian
ølooks cool and seems to work on my system)
This all was prompted by the fact I’m looking for a one (or 2) character function name that wouldn’t conflict with an existing or commonly used name, and would look a bit funky.
. is already used a lot and I use
.. already as well.
R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale:  LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252  LC_NUMERIC=C LC_TIME=English_United Kingdom.1252