Up and Down arrows inside R

https://www.alt-codes.net/arrow_alt_codes.php
Can I check if R is able to bring inside those up and down arrows? if yes, how?
Or is there certain package that is helpful?
I need those arrows to show the change in the values whether it is ascending or descending, which could be more visual.
Thanks.

Hello,

Are you planning to just display arrows int the console, or actually write them to a file? The latter is tricky because it will require correct encoding...

Here is an example of having arrows in the console

intToUtf8(c(8592:8703))

Here are all the codes:
https://www.w3schools.com/charsets/ref_utf_arrows.asp

But if you try to write this to a file, it will save a UTF-8 string instead of the actual symbol. I'm not good at encoding so don't know how to fix that easily

PJ

I have no explanation, but using directly readr::write_lines() the symbols are saved to the file, whereas base writeLines() seems to save the corresponding codepoints (but writeLines() can be made to save the symbol by changing the encoding).

Also useful to know, the hexadecimal values can be inserted directly in a character string: "other text...\U2190".

1 Like

Hi,

I read somewhere that the Tidyverse folk made encoding of this kind of stuff more straightforward, hence probably it working in write_lines (Tidyverse) and not writeLines (base R). It's still tricky though, because it won't work all the time it seems.

PJ

1 Like

Thanks for the suggestions, I will look into those links.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.