I have a long vector containing emojis, something like this:
emojis <- c("😐","😥","😴","😉","😛")
and then I have their utf-8 encodings which I extracted with the help of devtools::install_github( "ThinkRstat/utf8splain")
followed by library(utf8splain)
like this, just for example: (not accurately represented)
emojis_enc <- c()
for(i in 1:length(emojis)){
emojis_enc <- c(emojis_enc, utf8splain::runes(emojis[i])$rune)
}
#emojis_enc <- c("U+12345","U+67891","U+91234","U+56789","U+123A6")
Then I have made a function this:
emojiPlot <- function(photo_enc, emo_char){
png(paste0(photo_enc, ".png"))
plot(emo_char, rescale = T, ylim = c(-1,1), xlim = c(-1,1))
dev.off()
}
And when I do this emojiPlot("emojis_enc[1]", emojis[1])
I just get an empty plot with x and y axis. I am pretty novice with UTF and R.
The reason why I am doing is because I am using a plugin called "imagepreview" in gephi software. And the plugin requires the nodes as photos. So my goal is to have individual emojis in .png and give them their utf encodings as the name. So when I import my data, I can just point the CSV containing the utfs to the names of the photos and pull the right emoji. And then just graph it. I am doing this for research project, and have been stuck in it for a while. Please do help if you can.
If you know a better way to do this, I would really appreciate it too.
I am in Ubuntu OS. If you use windows, then emojis will show as their correct utf format, and won't be rendered.