In R, there is something called raw-vector/raw-characters. The one from the "rawToChar" and "charToRaw" functions etc. If you put a raw-vector into the console, it gets printed. One such raw element might be printed as "83". Now I want to check whether for a given raw-character, it is equal to the raw-character that is printed as "83". So I want to put that raw-character hard-coded into my code to compare against. How do I do it?
The only way I found is using charToRaw("ƒ"). However this only works in the console. Putting ƒ into the source-code of an RStudio file is difficult. Just try:
83 is a raw value, i.e., a hexadecimal number.
You can use this:
intToUtf8(8 * 16 + 3) == "ƒ" # TRUE
x <- rawToChar(as.raw(8*16+3)) Encoding(x) <- "latin1" x == "ƒ" # TRUE
It's dangerous and not necessary to hard-code a UTF-8 character in source code.